mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-11 05:54:16 +01:00
Some runtime infos now resides in preferences under runtime.* keys
This commit is contained in:
parent
ab00a1360f
commit
b295ab911e
@ -149,6 +149,14 @@ public class Preferences {
|
|||||||
"You'll need to reinstall Arduino."), e);
|
"You'll need to reinstall Arduino."), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set some runtime constants (not saved on preferences file)
|
||||||
|
table.put("runtime.os", PConstants.platformNames[PApplet.platform]);
|
||||||
|
String idePath = System.getProperty("user.dir");
|
||||||
|
if (Base.isMacOS())
|
||||||
|
idePath += "/Arduino.app/Contents/Resources/Java";
|
||||||
|
table.put("runtime.ide.path", idePath);
|
||||||
|
table.put("runtime.ide.version", "" + Base.REVISION);
|
||||||
|
|
||||||
// check for platform-specific properties in the defaults
|
// check for platform-specific properties in the defaults
|
||||||
String platformExt = "." + PConstants.platformNames[PApplet.platform];
|
String platformExt = "." + PConstants.platformNames[PApplet.platform];
|
||||||
int platformExtLength = platformExt.length();
|
int platformExtLength = platformExt.length();
|
||||||
@ -607,6 +615,8 @@ public class Preferences {
|
|||||||
Enumeration e = table.keys(); //properties.propertyNames();
|
Enumeration e = table.keys(); //properties.propertyNames();
|
||||||
while (e.hasMoreElements()) {
|
while (e.hasMoreElements()) {
|
||||||
String key = (String) e.nextElement();
|
String key = (String) e.nextElement();
|
||||||
|
if (key.startsWith("runtime."))
|
||||||
|
continue;
|
||||||
writer.println(key + "=" + ((String) table.get(key)));
|
writer.println(key + "=" + ((String) table.get(key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,20 +792,10 @@ public class Preferences {
|
|||||||
return new SyntaxStyle(color, italic, bold, underlined);
|
return new SyntaxStyle(color, italic, bold, underlined);
|
||||||
}
|
}
|
||||||
|
|
||||||
//get a Map of the Preferences
|
// get a copy of the Preferences
|
||||||
static public PreferencesMap getMap()
|
static public PreferencesMap getMap()
|
||||||
{
|
{
|
||||||
PreferencesMap globalpreferences = new PreferencesMap();
|
return new PreferencesMap(table);
|
||||||
Enumeration<String> e = table.keys();
|
|
||||||
|
|
||||||
while (e.hasMoreElements())
|
|
||||||
{
|
|
||||||
String key = (String) e.nextElement();
|
|
||||||
String value = (String) table.get(key);
|
|
||||||
globalpreferences.put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return globalpreferences;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,17 @@ 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.Hashtable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import processing.core.PApplet;
|
import processing.core.PApplet;
|
||||||
|
|
||||||
public class PreferencesMap extends HashMap<String, String> {
|
public class PreferencesMap extends HashMap<String, String> {
|
||||||
|
|
||||||
|
public PreferencesMap(Hashtable table) {
|
||||||
|
super(table);
|
||||||
|
}
|
||||||
|
|
||||||
public PreferencesMap(PreferencesMap prefs) {
|
public PreferencesMap(PreferencesMap prefs) {
|
||||||
super(prefs);
|
super(prefs);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user