From 9de7e20f5f3e74dd4503fa4f108ba3a57c0c25b7 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Sun, 16 Jul 2023 19:05:01 -0600 Subject: [PATCH] feat: save `userconfig.json` to `.ass-data/` dir --- backend/UserConfig.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/UserConfig.ts b/backend/UserConfig.ts index f180ffe..77bca22 100644 --- a/backend/UserConfig.ts +++ b/backend/UserConfig.ts @@ -3,6 +3,8 @@ import { path } from '@tycrek/joint'; import { UserConfiguration, UserConfigTypeChecker } from 'ass'; import { log } from './log'; +const FILEPATH = path.join('.ass-data/userconfig.json'); + /** * Returns a boolean if the provided value is a number */ @@ -121,7 +123,7 @@ export class UserConfig { if (!UserConfig._ready) throw new Error('Config not ready to be saved!'); // Write to file - await fs.writeFile(path.join('userconfig.json'), JSON.stringify(UserConfig._config, null, '\t')); + await fs.writeFile(FILEPATH, JSON.stringify(UserConfig._config, null, '\t')); resolve(void 0); } catch (err) { @@ -139,7 +141,7 @@ export class UserConfig { try { // Read the file data - const data = (await fs.readFile(path.join('userconfig.json'))).toString(); + const data = (await fs.readFile(FILEPATH)).toString(); // Ensure the config is valid UserConfig._config = UserConfig.parseConfig(data);