Skip to content

Commit

Permalink
Don't add keys (and display a warning) if the missing key doesn't mak…
Browse files Browse the repository at this point in the history
…e sense in target platform.txt. For a key to make sense, two tree level must be present already, eg: tools.avrdude
  • Loading branch information
Federico Fissore committed Apr 1, 2015
1 parent 6e9d0e5 commit 5dd4935
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions arduino-core/src/processing/app/debug/LegacyTargetPlatform.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@ private void rewriteKeysOfOldPlatformsTxtAndWarnAboutIt() throws IOException {

PreferencesMap addedProps = platformRewriteProps.subTree("added");
for (Map.Entry<String, String> entry : addedProps.entrySet()) {
if (!preferences.containsKey(entry.getKey())) {
System.err.println(I18n.format(_("Warning: platform.txt from core '{0}' misses property {1}, automatically set to {2}. Consider upgrading this core."), platformName, entry.getKey(), entry.getValue()));
preferences.put(entry.getKey(), entry.getValue());
String keyToAdd = entry.getKey();
String[] keyToAddParts = keyToAdd.split("\\.");
String keyToAddFirstLevel = keyToAddParts[0];
String keyToAddSecondLevel = keyToAddParts[0] + "." + keyToAddParts[1];
if (!preferences.subTree(keyToAddFirstLevel).isEmpty() && !preferences.subTree(keyToAddSecondLevel).isEmpty() && !preferences.containsKey(keyToAdd)) {
System.err.println(I18n.format(_("Warning: platform.txt from core '{0}' misses property {1}, automatically set to {2}. Consider upgrading this core."), platformName, keyToAdd, entry.getValue()));
preferences.put(keyToAdd, entry.getValue());
}
}
}
Expand Down

0 comments on commit 5dd4935

Please sign in to comment.