refactor: main code

This commit is contained in:
kangfenmao
2024-11-02 23:29:16 +08:00
parent 2f05435ce6
commit bddedb7759
13 changed files with 81 additions and 63 deletions
+9
View File
@@ -1,3 +1,4 @@
import fs from 'node:fs'
import path from 'node:path'
import { app } from 'electron'
@@ -5,3 +6,11 @@ import { app } from 'electron'
export function getResourcePath() {
return path.join(app.getAppPath(), 'resources')
}
export function getDataPath() {
const dataPath = path.join(app.getPath('userData'), 'Data')
if (!fs.existsSync(dataPath)) {
fs.mkdirSync(dataPath, { recursive: true })
}
return dataPath
}