@@ -28,6 +28,7 @@ public class ArduinoPlatformToolVersion extends Node {
28
28
private List <ArduinpPlatformToolSystem > mySystems = new ArrayList <>();
29
29
30
30
private transient ArduinoPlatformTool myParentTool ;
31
+ private transient IPath myInstallPath = null ;
31
32
32
33
@ SuppressWarnings ("nls" )
33
34
public ArduinoPlatformToolVersion (JsonElement json , ArduinoPlatformTool tool ) {
@@ -64,8 +65,37 @@ public List<ArduinpPlatformToolSystem> getSystems() {
64
65
return mySystems ;
65
66
}
66
67
68
+ /**
69
+ * This method is fucking wierd ...
70
+ * but I can't help it...
71
+ * The problem is that the tool depency references a packager (which is part of
72
+ * the install path)
73
+ * but the tool itself doe not
74
+ * So to know where to install there are 2 options
75
+ * 1) install in the local platform (resulting in tool duplication)
76
+ * 2) search the dependency tree for the tooldepency and use the installpath
77
+ * from there
78
+ *
79
+ * @return
80
+ */
67
81
public IPath getInstallPath () {
68
- return myParentTool .getInstallPath ().append (getID ());
82
+ if (myInstallPath != null ) {
83
+ return myInstallPath ;
84
+ }
85
+ ArduinoPackage pkg = myParentTool .getPackage ();
86
+ for (ArduinoPlatform curPlatform : pkg .getPlatforms ()) {
87
+ for (ArduinoPlatformVersion curplatformVersion : curPlatform .getVersions ()) {
88
+ for (ArduinoPlatformTooldDependency curTooldependency : curplatformVersion .getToolsDependencies ()) {
89
+ if (curTooldependency .getName ().equals (myParentTool .getName ())
90
+ && curTooldependency .getVersion ().compareTo (myVersion ) == 0 ) {
91
+ myInstallPath = curTooldependency .getInstallPath ();
92
+ return myInstallPath ;
93
+ }
94
+ }
95
+ }
96
+ }
97
+ myInstallPath = myParentTool .getInstallPath ().append (getID ());
98
+ return myInstallPath ;
69
99
70
100
}
71
101
0 commit comments