Skip to content

Fixed incorrect boards.txt preference handling when submenu id has underscore #2582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2015
Merged
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
19 changes: 14 additions & 5 deletions arduino-core/src/processing/app/BaseNoGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,27 @@ static public PreferencesMap getBoardPreferences() {
TargetBoard board = getTargetBoard();
if (board == null)
return null;
String boardId = board.getId();

PreferencesMap prefs = new PreferencesMap(board.getPreferences());

String extendedName = prefs.get("name");
for (String menuId : board.getMenuIds()) {
if (!board.hasMenu(menuId))
continue;

// Get "custom_[MENU_ID]" preference (for example "custom_cpu")
String entry = PreferencesData.get("custom_" + menuId);
if (board.hasMenu(menuId) && entry != null &&
entry.startsWith(board.getId())) {
String selectionId = entry.substring(entry.indexOf("_") + 1);
if (entry != null && entry.startsWith(boardId)) {

String selectionId = entry.substring(boardId.length() + 1);
prefs.putAll(board.getMenuPreferences(menuId, selectionId));
prefs.put("name", prefs.get("name") + ", " +
board.getMenuLabel(menuId, selectionId));

// Update the name with the extended configuration
extendedName += ", " + board.getMenuLabel(menuId, selectionId);
}
}
prefs.put("name", extendedName);
return prefs;
}

Expand Down