Skip to content

Commit 4f67d31

Browse files
author
jantje
committed
boards that have no platform.txt default to default tools
The redirect test shows this error
1 parent cc19b75 commit 4f67d31

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

io.sloeber.core/src/io/sloeber/core/api/BoardDescription.java

+10-5
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,7 @@ public Map<String, String> getEnvVars() {
890890
allVars.put(ENV_KEY_REFERENCED_VARIANT_PLATFORM_PATH, getReferencedVariantPlatformPath().toOSString());
891891
allVars.put(ENV_KEY_REFERENCED_UPLOAD_PLATFORM_PATH, getReferencedUploadPlatformPath().toOSString());
892892

893+
893894
PlatformTxtFile referencedPlatfromFile = getreferencedPlatformFile();
894895
// process the platform file referenced by the boards.txt
895896
if (referencedPlatfromFile != null) {
@@ -901,8 +902,11 @@ public Map<String, String> getEnvVars() {
901902
allVars.putAll(referencingPlatfromFile.getAllEnvironVars());
902903
}
903904

905+
// put in the installed tools info
904906
allVars.putAll(getEnVarPlatformInfo());
905907

908+
909+
906910
Programmers localProgrammers[] = Programmers.fromBoards(this);
907911
String programmer = getProgrammer();
908912
for (Programmers curProgrammer : localProgrammers) {
@@ -937,15 +941,16 @@ public Map<String, String> getEnvVars() {
937941
}
938942

939943
private Map<String, String> getEnVarPlatformInfo() {
940-
if ((getReferencingPlatformFile() == null) || (getreferencedPlatformFile() == null)) {
944+
IPath referencingPlatformPath = getreferencingPlatformPath();
945+
IPath referencedPlatformPath = getReferencedCorePlatformPath();
946+
947+
if ((referencingPlatformPath == null) || (referencedPlatformPath == null)) {
941948
// something is seriously wrong -->shoot
942949
return new HashMap<>();
943950
}
944-
File referencingPlatformFile = getReferencingPlatformFile().getTxtFile();
945-
ArduinoPlatform referencingPlatform = InternalPackageManager.getPlatform(referencingPlatformFile);
946-
File referencedPlatformFile = getreferencedPlatformFile().getTxtFile();
947951

948-
ArduinoPlatform referencedPlatform = InternalPackageManager.getPlatform(referencedPlatformFile);
952+
ArduinoPlatform referencingPlatform = InternalPackageManager.getPlatform(referencingPlatformPath);
953+
ArduinoPlatform referencedPlatform = InternalPackageManager.getPlatform(referencedPlatformPath);
949954

950955
boolean jsonBasedPlatformManagement = !Preferences.getUseArduinoToolSelection();
951956
if (jsonBasedPlatformManagement) {

io.sloeber.core/src/io/sloeber/core/managers/InternalPackageManager.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ public static IPath getPlatformInstallPath(String refVendor, String refArchitect
237237
* @param platformTxt
238238
* @return the found platform otherwise null
239239
*/
240-
public static ArduinoPlatform getPlatform(File platformTxt) {
240+
public static ArduinoPlatform getPlatform(IPath platformPath) {
241241
for (PackageIndex index : getPackageIndices()) {
242242
for (Package pkg : index.getPackages()) {
243243
for (ArduinoPlatform curPlatform : pkg.getPlatforms()) {
244-
if (curPlatform.getPlatformFile().equals(platformTxt)) {
244+
if (curPlatform.getInstallPath().equals(platformPath)) {
245245
return curPlatform;
246246
}
247247
}

0 commit comments

Comments
 (0)