22
22
import org .eclipse .core .runtime .preferences .IEclipsePreferences ;
23
23
import org .eclipse .core .runtime .preferences .InstanceScope ;
24
24
25
- import io .sloeber .core .api .Json .ArduinoPackage ;
26
25
import io .sloeber .core .api .Json .ArduinoPlatform ;
27
- import io .sloeber .core .api .Json .ArduinoPlatformTool ;
28
- import io .sloeber .core .api .Json .ArduinoPlatformToolVersion ;
29
26
import io .sloeber .core .api .Json .ArduinoPlatformTooldDependency ;
30
27
import io .sloeber .core .api .Json .ArduinoPlatformVersion ;
31
28
import io .sloeber .core .common .Common ;
@@ -860,7 +857,8 @@ private Map<String, String> getEnVarPlatformInfo() {
860
857
861
858
if (myReferencedPlatformCore == null ) {
862
859
//there is no referenced core so no need to do smart stuff
863
- return getEnvVarPlatformFileTools (referencingPlatform );
860
+ ret .putAll (getEnvVarPlatformFileTools (referencingPlatform ));
861
+ return ret ;
864
862
}
865
863
866
864
boolean jsonBasedPlatformManagement = !Preferences .getUseArduinoToolSelection ();
@@ -878,25 +876,23 @@ private Map<String, String> getEnVarPlatformInfo() {
878
876
}
879
877
880
878
/**
881
- * This method only returns environment variables without the version number
882
- * The environment variables with version number are "global" and as sutch are
883
- * understood to exists
879
+ * This method only returns environment variables with and without version
880
+ * number
881
+ * These are purely based on the tool dependencies
884
882
*
885
883
* @param platformVersion
886
884
* @return environment variables pointing to the tools used by the platform
887
885
*/
888
886
private static Map <String , String > getEnvVarPlatformFileTools (ArduinoPlatformVersion platformVersion ) {
889
887
HashMap <String , String > vars = new HashMap <>();
890
- if (platformVersion .getToolsDependencies () == null ) {
891
- return vars ;
892
- }
893
- ArduinoPackage pkg = platformVersion .getParent ().getParent ();
894
888
for (ArduinoPlatformTooldDependency tool : platformVersion .getToolsDependencies ()) {
895
- ArduinoPlatformTool theTool = pkg .getTool (tool .getName ());
896
- ArduinoPlatformToolVersion theNewestTool = theTool .getNewestInstalled ();
897
- if (theNewestTool != null ) {
898
- vars .putAll (theNewestTool .getEnvVars (false ));
899
- }
889
+ String installPath = tool .getInstallPath ().toOSString ();
890
+ String keyString = RUNTIME_TOOLS + tool .getName () + tool .getVersion () + DOT_PATH ;
891
+ vars .put (keyString , installPath );
892
+ keyString = RUNTIME_TOOLS + tool .getName () + '-' + tool .getVersion () + DOT_PATH ;
893
+ vars .put (keyString , installPath );
894
+ keyString = RUNTIME_TOOLS + tool .getName () + DOT_PATH ;
895
+ vars .put (keyString , installPath );
900
896
}
901
897
return vars ;
902
898
}
0 commit comments