mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-22 08:22:04 +03:00
Add --no-save-prefs option
This allows setting preferences for the current run only, without remembering them for the next run. This is especially useful when combined with --verify or --upload.
This commit is contained in:
committed by
Cristian Maglie
parent
bbd0128664
commit
4452eb3850
@ -385,6 +385,10 @@ public class Base {
|
||||
processPrefArgument(args[i]);
|
||||
continue;
|
||||
}
|
||||
if (args[i].equals("--no-save-prefs")) {
|
||||
Preferences.setDoSave(false);
|
||||
continue;
|
||||
}
|
||||
if (args[i].equals("--preferences-file")) {
|
||||
i++;
|
||||
if (i >= args.length)
|
||||
|
@ -220,6 +220,7 @@ public class Preferences {
|
||||
static Hashtable<String, String> defaults;
|
||||
static Hashtable<String, String> table = new Hashtable<String, String>();
|
||||
static File preferencesFile;
|
||||
static boolean doSave = true;
|
||||
|
||||
|
||||
static protected void init(String args[]) {
|
||||
@ -789,6 +790,7 @@ public class Preferences {
|
||||
|
||||
|
||||
static protected void save() {
|
||||
if (!doSave) return;
|
||||
// try {
|
||||
// on startup, don't worry about it
|
||||
// this is trying to update the prefs for who is open
|
||||
@ -989,4 +991,10 @@ public class Preferences {
|
||||
return new PreferencesMap(table);
|
||||
}
|
||||
|
||||
// Decide wether changed preferences will be saved. When value is
|
||||
// false, Preferences.save becomes a no-op.
|
||||
static public void setDoSave(boolean value)
|
||||
{
|
||||
doSave = value;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user