1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-15 00:02:49 +03:00

Merge pull request #2582 from cmaglie/fix-underscore-glitch

Fixed incorrect boards.txt preference handling when submenu id has underscore
This commit is contained in:
Federico Fissore
2015-02-11 16:42:46 +01:00

View File

@ -149,18 +149,27 @@ public class BaseNoGui {
TargetBoard board = getTargetBoard(); TargetBoard board = getTargetBoard();
if (board == null) if (board == null)
return null; return null;
String boardId = board.getId();
PreferencesMap prefs = new PreferencesMap(board.getPreferences()); PreferencesMap prefs = new PreferencesMap(board.getPreferences());
String extendedName = prefs.get("name");
for (String menuId : board.getMenuIds()) { 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); String entry = PreferencesData.get("custom_" + menuId);
if (board.hasMenu(menuId) && entry != null && if (entry != null && entry.startsWith(boardId)) {
entry.startsWith(board.getId())) {
String selectionId = entry.substring(entry.indexOf("_") + 1); String selectionId = entry.substring(boardId.length() + 1);
prefs.putAll(board.getMenuPreferences(menuId, selectionId)); 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; return prefs;
} }