mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
@@ -14,8 +14,13 @@ const settingsPath = paths.pathTo('settings', `settings.json`);
|
|||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
export async function loadSettings() {
|
export async function loadSettings() {
|
||||||
|
try {
|
||||||
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) {
|
||||||
|
writeFileAsync(settingsPath, '{}', 'utf8');
|
||||||
|
return {} as Settings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
|
|||||||
Reference in New Issue
Block a user