From 069a37b55072008ffcd06039945552a1953e0ada Mon Sep 17 00:00:00 2001 From: Walidoux Date: Sun, 23 Apr 2023 23:29:02 +0100 Subject: [PATCH] fix(tools): fs-path for parseData --- src/tools/parseData.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) }