Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions app/src/processing/app/debug/TargetPlatform.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,42 @@ public TargetPlatform(String _name, File _folder) {
String notused = _("Processor");
}

PreferencesMap boardPreferences = new PreferencesMap();

try {
File boardsFile = new File(_folder, "boards.txt");
if (boardsFile.exists() && boardsFile.canRead()) {
PreferencesMap boardPreferences = new PreferencesMap();
boardPreferences.load(boardsFile);
boards = boardPreferences.createFirstLevelMap();
customMenus = MapWithSubkeys.createFrom(boards.get("menu"));
boards.remove("menu");
}
} catch (Exception e) {
e.printStackTrace();
System.err.println("Error loading boards from boards.txt: " + e);
}

try {
File boardsDir = new File(_folder, "boards");
if (boardsDir.isDirectory()) {
for (String name : boardsDir.list()) {
if (name.endsWith(".txt")) {
try {
File boardsFile = new File(boardsDir, name);
if (boardsFile.exists()) {
boardPreferences.load(boardsFile);
}
} catch (Exception e) {
}
}
}
}
} catch (Exception e) {
}

if (boardPreferences.size() == 0) {
System.err.println("No board definitions found in boards.txt and boards directory");
}

boards = boardPreferences.createFirstLevelMap();
customMenus = MapWithSubkeys.createFrom(boards.get("menu"));
boards.remove("menu");

try {
File platformsFile = new File(_folder, "platform.txt");
if (platformsFile.exists() && platformsFile.canRead()) {
Expand Down