Skip to content

Commit d8f3054

Browse files
committed
Extend platforms with Boards.local.txt
1 parent 7e0adeb commit d8f3054

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Diff for: arduino-core/src/processing/app/debug/LegacyTargetPlatform.java

+17-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,23 @@ public LegacyTargetPlatform(String _name, File _folder, TargetPackage parent)
7070

7171
// Load boards
7272
try {
73-
Map<String, PreferencesMap> boardsPreferences = new PreferencesMap(
74-
boardsFile).firstLevelMap();
73+
PreferencesMap bPrefs = new PreferencesMap(
74+
boardsFile);
75+
76+
// Allow overriding values in boards.txt. This allows changing
77+
// boards.txt (e.g. to add user-specific items to a menu), without
78+
// having to modify boards.txt (which, when running from git,
79+
// prevents files being marked as changed).
80+
File localboardsFile = new File(folder, "boards.local.txt");
81+
try {
82+
if (localboardsFile.exists() && localboardsFile.canRead()) {
83+
bPrefs.load(localboardsFile);
84+
}
85+
} catch (IOException e) {
86+
throw new TargetPlatformException(
87+
format(tr("Error loading {0}"), localboardsFile.getAbsolutePath()), e);
88+
}
89+
Map<String, PreferencesMap> boardsPreferences = bPrefs.firstLevelMap();
7590

7691
// Create custom menus for this platform
7792
PreferencesMap menus = boardsPreferences.get("menu");

0 commit comments

Comments
 (0)