mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 13:55:04 +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');
|
||||
return JSON.parse(json) as Settings;
|
||||
} catch (e) {
|
||||
writeFileAsync(settingsPath, '{}', 'utf8');
|
||||
return {} as Settings;
|
||||
if (e === 'ENOENT') {
|
||||
writeFileAsync(settingsPath, '{}', 'utf8');
|
||||
return {} as Settings;
|
||||
} else {
|
||||
console.log("Error reading settings file: " + e);
|
||||
return {} as Settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user