mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-17 08:55:05 -04:00
Preserve pre-existing user settings
This prioritises pre-existing user settings in HOME over the XDG_CONFIG_HOME variable being set. HOME is still used as a fallback.
This commit is contained in:
parent
91b29e615e
commit
4fb8391364
@ -37,11 +37,14 @@ public class SettingsBase implements AttributeListener {
|
||||
protected SettingsBase(List<Key> settingsKeys, String name) {
|
||||
this.settingsKeys = settingsKeys;
|
||||
|
||||
File defaultSettings = new File(new File(System.getProperty("user.home")), name);
|
||||
String settingsDir = System.getenv("XDG_CONFIG_HOME");
|
||||
if (settingsDir == null) {
|
||||
settingsDir = System.getProperty("user.home");
|
||||
|
||||
if (defaultSettings.isFile() || settingsDir == null) {
|
||||
filename = defaultSettings;
|
||||
} else {
|
||||
filename = new File(settingsDir, name);
|
||||
}
|
||||
filename = new File(new File(settingsDir), name);
|
||||
|
||||
ElementAttributes attr = null;
|
||||
if (filename.exists()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user