mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-12-03 05:10:04 +01:00
1 parent
735845746e
commit
eab78e2100
1 file changed
+7
-2
@@ -14,8 +14,13 @@ const settingsPath = paths.pathTo('settings', `settings.json`);
|
||||
|
||||
/* istanbul ignore next */
|
||||
export async function loadSettings() {
|
||||
const json = await readFileAsync(settingsPath, 'utf8');
|
||||
return JSON.parse(json) as Settings;
|
||||
try {
|
||||
const json = await readFileAsync(settingsPath, 'utf8');
|
||||
return JSON.parse(json) as Settings;
|
||||
} catch (e) {
|
||||
writeFileAsync(settingsPath, '{}', 'utf8');
|
||||
return {} as Settings;
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
|
||||
Reference in new issue
Block a user