1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-26 20:54:22 +01:00

Merge pull request #3878 from Wackerbarth/BoardsLocal

Extend platforms with Boards.local.txt
This commit is contained in:
Federico Fissore 2015-09-29 17:01:38 +02:00
commit 38d8fa28f2

View File

@ -70,8 +70,23 @@ public class LegacyTargetPlatform implements TargetPlatform {
// Load boards
try {
Map<String, PreferencesMap> boardsPreferences = new PreferencesMap(
boardsFile).firstLevelMap();
PreferencesMap bPrefs = new PreferencesMap(
boardsFile);
// Allow overriding values in boards.txt. This allows changing
// boards.txt (e.g. to add user-specific items to a menu), without
// having to modify boards.txt (which, when running from git,
// prevents files being marked as changed).
File localboardsFile = new File(folder, "boards.local.txt");
try {
if (localboardsFile.exists() && localboardsFile.canRead()) {
bPrefs.load(localboardsFile);
}
} catch (IOException e) {
throw new TargetPlatformException(
format(tr("Error loading {0}"), localboardsFile.getAbsolutePath()), e);
}
Map<String, PreferencesMap> boardsPreferences = bPrefs.firstLevelMap();
// Create custom menus for this platform
PreferencesMap menus = boardsPreferences.get("menu");