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 .packages .ArduinoPlatform ;
25
+ import io .sloeber .core .api .Json .ArduinoPlatform ;
26
+ import io .sloeber .core .api .Json .ArduinoPlatformVersion ;
26
27
import io .sloeber .core .common .Common ;
27
28
import io .sloeber .core .common .ConfigurationPreferences ;
28
29
import io .sloeber .core .tools .Helpers ;
@@ -193,8 +194,13 @@ private void ParseSection() {
193
194
String refVendor = valueSplit [0 ];
194
195
String actualValue = valueSplit [1 ];
195
196
myBoardsCore = actualValue ;
196
- myReferencedCorePlatformPath = PackageManager .getPlatformInstallPath (refVendor , architecture );
197
- if (this .myReferencedCorePlatformPath == null ) {
197
+ ArduinoPlatform platform = BoardsManager .getPlatform (refVendor , architecture );
198
+ ArduinoPlatformVersion platformVersion = null ;
199
+ platformVersion = platform .getNewestInstalled ();
200
+ if (platformVersion != null ) {
201
+ myReferencedCorePlatformPath = platformVersion .getInstallPath ();
202
+ }
203
+ if (myReferencedCorePlatformPath == null ) {
198
204
Common .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID ,
199
205
Helpers_tool_reference_missing .replace (TOOL_TAG , core )
200
206
.replace (FILE_TAG , getReferencingBoardsFile ().toString ())
@@ -207,8 +213,11 @@ private void ParseSection() {
207
213
VersionNumber refVersion = new VersionNumber (valueSplit [2 ]);
208
214
String actualValue = valueSplit [3 ];
209
215
myBoardsCore = actualValue ;
210
- myReferencedCorePlatformPath = PackageManager . getPlatformInstallPath (refVendor , refArchitecture ,
216
+ ArduinoPlatformVersion platformVersion = BoardsManager . getPlatform (refVendor , refArchitecture ,
211
217
refVersion );
218
+ if (platformVersion != null ) {
219
+ myReferencedCorePlatformPath = platformVersion .getInstallPath ();
220
+ }
212
221
if (this .myReferencedCorePlatformPath == null ) {
213
222
Common .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID ,
214
223
Helpers_tool_reference_missing .replace (TOOL_TAG , core )
@@ -226,7 +235,7 @@ private void ParseSection() {
226
235
String refVendor = valueSplit [0 ];
227
236
String actualValue = valueSplit [1 ];
228
237
this .myBoardsVariant = actualValue ;
229
- this .myReferencedBoardVariantPlatformPath = PackageManager .getPlatformInstallPath (refVendor ,
238
+ this .myReferencedBoardVariantPlatformPath = BoardsManager .getPlatformInstallPath (refVendor ,
230
239
architecture );
231
240
if (this .myReferencedBoardVariantPlatformPath == null ) {
232
241
Common .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID ,
@@ -242,10 +251,10 @@ private void ParseSection() {
242
251
String actualValue = valueSplit [3 ];
243
252
this .myBoardsVariant = actualValue ;
244
253
if ("*" .equals (refVersion )) { //$NON-NLS-1$
245
- this .myReferencedBoardVariantPlatformPath = PackageManager .getPlatformInstallPath (refVendor ,
254
+ this .myReferencedBoardVariantPlatformPath = BoardsManager .getPlatformInstallPath (refVendor ,
246
255
refArchitecture );
247
256
} else {
248
- this .myReferencedBoardVariantPlatformPath = PackageManager .getPlatformInstallPath (refVendor ,
257
+ this .myReferencedBoardVariantPlatformPath = BoardsManager .getPlatformInstallPath (refVendor ,
249
258
refArchitecture , refVersion );
250
259
}
251
260
if (this .myReferencedBoardVariantPlatformPath == null ) {
@@ -265,8 +274,7 @@ private void ParseSection() {
265
274
String refVendor = valueSplit [0 ];
266
275
String actualValue = valueSplit [1 ];
267
276
this .myUploadTool = actualValue ;
268
- this .myReferencedUploadToolPlatformPath = PackageManager .getPlatformInstallPath (refVendor ,
269
- architecture );
277
+ this .myReferencedUploadToolPlatformPath = BoardsManager .getPlatformInstallPath (refVendor , architecture );
270
278
if (this .myReferencedUploadToolPlatformPath == null ) {
271
279
Common .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID ,
272
280
Helpers_tool_reference_missing .replace (TOOL_TAG , upload )
@@ -280,7 +288,7 @@ private void ParseSection() {
280
288
VersionNumber refVersion = new VersionNumber (valueSplit [2 ]);
281
289
String actualValue = valueSplit [3 ];
282
290
this .myUploadTool = actualValue ;
283
- this .myReferencedUploadToolPlatformPath = PackageManager .getPlatformInstallPath (refVendor ,
291
+ this .myReferencedUploadToolPlatformPath = BoardsManager .getPlatformInstallPath (refVendor ,
284
292
refArchitecture , refVersion );
285
293
if (this .myReferencedUploadToolPlatformPath == null ) {
286
294
Common .log (new Status (IStatus .ERROR , CORE_PLUGIN_ID ,
@@ -668,7 +676,12 @@ public IPath getreferencedHardwarePath() {
668
676
*/
669
677
public IPath getArduinoPlatformPath () {
670
678
updateWhenDirty ();
671
- return PackageManager .getPlatformInstallPath (VendorArduino , getArchitecture ());
679
+ ArduinoPlatform platform = BoardsManager .getPlatform (VendorArduino , getArchitecture ());
680
+ if (platform == null ) {
681
+ return null ;
682
+ }
683
+ ArduinoPlatformVersion platformVersion = platform .getNewestInstalled ();
684
+ return platformVersion .getInstallPath ();
672
685
}
673
686
674
687
/**
@@ -892,8 +905,8 @@ private Map<String, String> getEnVarPlatformInfo() {
892
905
return new HashMap <>();
893
906
}
894
907
895
- ArduinoPlatform referencingPlatform = PackageManager .getPlatform (referencingPlatformPath );
896
- ArduinoPlatform referencedPlatform = PackageManager .getPlatform (referencedPlatformPath );
908
+ ArduinoPlatformVersion referencingPlatform = BoardsManager .getPlatform (referencingPlatformPath );
909
+ ArduinoPlatformVersion referencedPlatform = BoardsManager .getPlatform (referencedPlatformPath );
897
910
898
911
boolean jsonBasedPlatformManagement = !Preferences .getUseArduinoToolSelection ();
899
912
if (jsonBasedPlatformManagement ) {
0 commit comments