mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-15 12:29:26 +01:00
Implemented OS specific preferences
This commit is contained in:
parent
af5de4ed63
commit
33f5c53668
@ -29,9 +29,12 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import processing.app.Base;
|
||||||
import processing.core.PApplet;
|
import processing.core.PApplet;
|
||||||
|
|
||||||
public class PreferencesMap extends HashMap<String, String> {
|
public class PreferencesMap extends HashMap<String, String> {
|
||||||
@ -78,6 +81,25 @@ public class PreferencesMap extends HashMap<String, String> {
|
|||||||
put(key.trim(), value.trim());
|
put(key.trim(), value.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is needed to avoid ConcurrentAccessExceptions
|
||||||
|
Set<String> keys = new HashSet<String>(keySet());
|
||||||
|
|
||||||
|
// Override keys that have OS specific versions
|
||||||
|
for (String k : keys) {
|
||||||
|
boolean replace = false;
|
||||||
|
if (Base.isLinux() && k.endsWith(".linux"))
|
||||||
|
replace = true;
|
||||||
|
if (Base.isWindows() && k.endsWith(".windows"))
|
||||||
|
replace = true;
|
||||||
|
if (Base.isMacOS() && k.endsWith(".macos"))
|
||||||
|
replace = true;
|
||||||
|
if (replace) {
|
||||||
|
int dot = k.lastIndexOf('.');
|
||||||
|
String overridenKey = k.substring(0, dot);
|
||||||
|
put(overridenKey, get(k));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user