@@ -212,20 +212,28 @@ private void syncBuiltInHardware() throws IOException {
212
212
}
213
213
for (File folder : builtInHardwareFolder .listFiles (ONLY_DIRS )) {
214
214
ContributedPackage pack = index .findPackage (folder .getName ());
215
- if (pack != null ) {
216
- syncBuiltInPackageWithFilesystem (pack , folder );
217
-
218
- File toolsFolder = new File (builtInHardwareFolder , "tools" );
219
- if (toolsFolder .isDirectory ()) {
220
- for (File toolFolder : toolsFolder .listFiles (ONLY_DIRS )) {
221
- File builtInToolsMetadata = new File (toolFolder , "builtin_tools_versions.txt" );
222
- if (builtInToolsMetadata .isFile ()) {
223
- PreferencesMap toolsMetadata = new PreferencesMap (builtInToolsMetadata ).subTree (pack .getName ());
224
- for (Map .Entry <String , String > toolMetadata : toolsMetadata .entrySet ()) {
225
- syncToolWithFilesystem (pack , toolFolder , toolMetadata .getKey (), toolMetadata .getValue ());
226
- }
227
- }
228
- }
215
+ if (pack == null )
216
+ continue ;
217
+ syncBuiltInPackageWithFilesystem (pack , folder );
218
+
219
+ File toolsFolder = new File (builtInHardwareFolder , "tools" );
220
+ if (!toolsFolder .isDirectory ())
221
+ continue ;
222
+
223
+ for (File toolFolder : toolsFolder .listFiles (ONLY_DIRS )) {
224
+
225
+ // builtin_tools_versions.txt contains tools versions in the format:
226
+ // "PACKAGER.TOOL_NAME=TOOL_VERSION"
227
+ // for example:
228
+ // "arduino.avrdude=6.0.1-arduino5"
229
+
230
+ File versionsFile = new File (toolFolder , "builtin_tools_versions.txt" );
231
+ if (!versionsFile .isFile ())
232
+ continue ;
233
+ PreferencesMap toolsVersion = new PreferencesMap (versionsFile ).subTree (pack .getName ());
234
+ for (String name : toolsVersion .keySet ()) {
235
+ String version = toolsVersion .get (name );
236
+ syncToolWithFilesystem (pack , toolFolder , name , version );
229
237
}
230
238
}
231
239
}
0 commit comments