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