feat: 解决build bug

This commit is contained in:
qier222 2022-04-02 00:45:20 +08:00
parent 46fe2d734e
commit e99c4833f7
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
47 changed files with 1236 additions and 611 deletions

14
src/main/utils.ts Normal file
View file

@ -0,0 +1,14 @@
import fs from 'fs'
export const createDirIfNotExist = (dir: string) => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true })
}
}
export const createFileIfNotExist = (file: string) => {
createDirIfNotExist(file.split('/').slice(0, -1).join('/'))
if (!fs.existsSync(file)) {
fs.writeFileSync(file, '')
}
}