diff --git a/src/tools/parseData.ts b/src/tools/parseData.ts index ec99ece..91b3659 100644 --- a/src/tools/parseData.ts +++ b/src/tools/parseData.ts @@ -1,9 +1,12 @@ import { createDir, exists, writeTextFile } from '@tauri-apps/api/fs' +import { Convertion } from '../config/Convertion' + export const parseData = async (path: string, fileName: string, fileContent: string | object): Promise => { const fileDir = path.concat(`/${fileName}.json`) - if (!(await exists(path))) await createDir(path) + if (!(await exists(Convertion.gamedataDir))) await createDir(Convertion.gamedataDir) + if (!(await exists(Convertion.gamedataConfigDir))) await createDir(Convertion.gamedataConfigDir) await writeTextFile(fileDir, typeof fileContent === 'object' ? JSON.stringify(fileContent) : fileContent) }