Skip to content

Commit 4f1b584

Browse files
committed
Slightly refactored tool resolution
This helps the understanding of next commits
1 parent 3b57462 commit 4f1b584

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

arduino-core/src/processing/app/BaseNoGui.java

+13-9
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,20 @@ static public PreferencesMap getBoardPreferences() {
164164
prefs.put("name", extendedName);
165165

166166
// Resolve tools needed for this board
167+
List<ContributedTool> requiredTools = new ArrayList<>();
168+
169+
// Add all tools dependencies specified in package index
167170
ContributedPlatform platform = indexer.getContributedPlaform(getTargetPlatform());
168-
if (platform != null) {
169-
String prefix = "runtime.tools.";
170-
for (ContributedTool tool : platform.getResolvedTools()) {
171-
File folder = tool.getDownloadableContribution(getPlatform()).getInstalledFolder();
172-
String toolPath = folder.getAbsolutePath();
173-
prefs.put(prefix + tool.getName() + ".path", toolPath);
174-
PreferencesData.set(prefix + tool.getName() + ".path", toolPath);
175-
PreferencesData.set(prefix + tool.getName() + "-" + tool.getVersion() + ".path", toolPath);
176-
}
171+
if (platform != null)
172+
requiredTools.addAll(platform.getResolvedTools());
173+
174+
String prefix = "runtime.tools.";
175+
for (ContributedTool tool : requiredTools) {
176+
File folder = tool.getDownloadableContribution(getPlatform()).getInstalledFolder();
177+
String toolPath = folder.getAbsolutePath();
178+
prefs.put(prefix + tool.getName() + ".path", toolPath);
179+
PreferencesData.set(prefix + tool.getName() + ".path", toolPath);
180+
PreferencesData.set(prefix + tool.getName() + "-" + tool.getVersion() + ".path", toolPath);
177181
}
178182
return prefs;
179183
}

0 commit comments

Comments
 (0)