Skip to content

Commit ff6fb31

Browse files
committed
Merge pull request #2582 from cmaglie/fix-underscore-glitch
Fixed incorrect boards.txt preference handling when submenu id has underscore
2 parents 5128a06 + e360f82 commit ff6fb31

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

arduino-core/src/processing/app/BaseNoGui.java

+14-5
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,27 @@ static public PreferencesMap getBoardPreferences() {
149149
TargetBoard board = getTargetBoard();
150150
if (board == null)
151151
return null;
152+
String boardId = board.getId();
152153

153154
PreferencesMap prefs = new PreferencesMap(board.getPreferences());
155+
156+
String extendedName = prefs.get("name");
154157
for (String menuId : board.getMenuIds()) {
158+
if (!board.hasMenu(menuId))
159+
continue;
160+
161+
// Get "custom_[MENU_ID]" preference (for example "custom_cpu")
155162
String entry = PreferencesData.get("custom_" + menuId);
156-
if (board.hasMenu(menuId) && entry != null &&
157-
entry.startsWith(board.getId())) {
158-
String selectionId = entry.substring(entry.indexOf("_") + 1);
163+
if (entry != null && entry.startsWith(boardId)) {
164+
165+
String selectionId = entry.substring(boardId.length() + 1);
159166
prefs.putAll(board.getMenuPreferences(menuId, selectionId));
160-
prefs.put("name", prefs.get("name") + ", " +
161-
board.getMenuLabel(menuId, selectionId));
167+
168+
// Update the name with the extended configuration
169+
extendedName += ", " + board.getMenuLabel(menuId, selectionId);
162170
}
163171
}
172+
prefs.put("name", extendedName);
164173
return prefs;
165174
}
166175

0 commit comments

Comments
 (0)