Skip to content

Commit ce773cc

Browse files
author
jantje
committed
Fix the os dependent problems in relation to menu in board.txt
1 parent 0c4036b commit ce773cc

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

io.sloeber.core/src/io/sloeber/core/api/BoardDescriptor.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import java.io.File;
44
import java.net.URI;
55
import java.util.ArrayList;
6-
import java.util.HashMap;
76
import java.util.Map;
87
import java.util.Map.Entry;
98
import java.util.Set;
@@ -108,7 +107,7 @@ protected BoardDescriptor(ICConfigurationDescription confdesc) {
108107
this.myBoardID = Common.getBuildEnvironmentVariable(confdesc, Const.ENV_KEY_JANTJE_BOARD_ID, "");
109108
this.myTxtFile = new TxtFile(this.myBoardsFile);
110109

111-
this.myOptions = new HashMap<>();
110+
this.myOptions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
112111
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
113112
IContributedEnvironment contribEnv = envManager.getContributedEnvironment();
114113
IEnvironmentVariable[] curVariables = contribEnv.getVariables(confdesc);
@@ -128,7 +127,8 @@ protected BoardDescriptor(File boardsFile, String boardID, Map<String, String> o
128127
this.myUploadPort = Const.EMPTY_STRING;
129128
this.myUploadProtocol = Defaults.getDefaultUploadProtocol();
130129
this.myBoardID = boardID;
131-
this.myOptions = options;
130+
this.myOptions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
131+
this.myOptions.putAll(options);
132132
this.myBoardsFile = boardsFile;
133133
this.myTxtFile = new TxtFile(this.myBoardsFile);
134134
}
@@ -359,10 +359,16 @@ public void setBoardsFile(File boardsFile) {
359359
}
360360

361361
public void setOptions(Map<String, String> options) {
362-
this.myOptions = options;
363-
362+
this.myOptions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
363+
this.myOptions.putAll(options);
364364
}
365365

366+
/**
367+
* Returns the options for this board This reflects the options selected
368+
* through the menu functionality in the boards.txt
369+
*
370+
* @return a map of case insensitive ordered key value pairs
371+
*/
366372
public Map<String, String> getOptions() {
367373
return this.myOptions;
368374
}
@@ -440,7 +446,7 @@ private String menuOptionsToString() {
440446
}
441447

442448
private void menuOptionsFromString(String options) {
443-
this.myOptions = new HashMap<>();
449+
this.myOptions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
444450
if (options != null) {
445451
String[] lines = options.split("\n"); //$NON-NLS-1$
446452
for (String curLine : lines) {

0 commit comments

Comments
 (0)