[Settings] Minor source cleanup
This commit is contained in:
parent
5669a499c1
commit
8260503b42
1 changed files with 2 additions and 6 deletions
|
@ -8,8 +8,7 @@ class Settings { // Heavily based on original for compat, but simplified and twe
|
||||||
try {
|
try {
|
||||||
this.lastSaved = readFileSync(this.path);
|
this.lastSaved = readFileSync(this.path);
|
||||||
this.settings = JSON.parse(this.lastSaved);
|
this.settings = JSON.parse(this.lastSaved);
|
||||||
} catch (_e) {
|
} catch (e) {
|
||||||
this.lastSaved = '';
|
|
||||||
this.settings = {};
|
this.settings = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,10 +34,7 @@ class Settings { // Heavily based on original for compat, but simplified and twe
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
if (this.lastModified && this.lastModified !== this.getLastModified()) { // File was last modified after Settings was made, so was externally edited therefore we don't save over
|
if (this.lastModified && this.lastModified !== this.getLastModified()) return; // File was last modified after Settings was made, so was externally edited therefore we don't save over
|
||||||
log('AppSettings', 'Modified date mismatch');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const toSave = JSON.stringify(this.settings, null, 2);
|
const toSave = JSON.stringify(this.settings, null, 2);
|
||||||
|
|
Loading…
Reference in a new issue