fix(tools): fs-path for parseData
This commit is contained in:
parent
cb66593b2c
commit
069a37b550
@ -1,9 +1,12 @@
|
|||||||
import { createDir, exists, writeTextFile } from '@tauri-apps/api/fs'
|
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<void> => {
|
export const parseData = async (path: string, fileName: string, fileContent: string | object): Promise<void> => {
|
||||||
const fileDir = path.concat(`/${fileName}.json`)
|
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)
|
await writeTextFile(fileDir, typeof fileContent === 'object' ? JSON.stringify(fileContent) : fileContent)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user