feat: save `userconfig.json` to `.ass-data/` dir

pull/243/head
Josh Moore 2 years ago
parent 9aa7df4a48
commit 9de7e20f5f

@ -3,6 +3,8 @@ import { path } from '@tycrek/joint';
import { UserConfiguration, UserConfigTypeChecker } from 'ass'; import { UserConfiguration, UserConfigTypeChecker } from 'ass';
import { log } from './log'; import { log } from './log';
const FILEPATH = path.join('.ass-data/userconfig.json');
/** /**
* Returns a boolean if the provided value is a number * 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!'); if (!UserConfig._ready) throw new Error('Config not ready to be saved!');
// Write to file // 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); resolve(void 0);
} catch (err) { } catch (err) {
@ -139,7 +141,7 @@ export class UserConfig {
try { try {
// Read the file data // 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 // Ensure the config is valid
UserConfig._config = UserConfig.parseConfig(data); UserConfig._config = UserConfig.parseConfig(data);

Loading…
Cancel
Save