mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Only create new settings file if file is missing
This commit is contained in:
@@ -18,8 +18,13 @@ export async function loadSettings() {
|
|||||||
const json = await readFileAsync(settingsPath, 'utf8');
|
const json = await readFileAsync(settingsPath, 'utf8');
|
||||||
return JSON.parse(json) as Settings;
|
return JSON.parse(json) as Settings;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
writeFileAsync(settingsPath, '{}', 'utf8');
|
if (e === 'ENOENT') {
|
||||||
return {} as Settings;
|
writeFileAsync(settingsPath, '{}', 'utf8');
|
||||||
|
return {} as Settings;
|
||||||
|
} else {
|
||||||
|
console.log("Error reading settings file: " + e);
|
||||||
|
return {} as Settings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user