YesPlayMusic/packages/electron/preload.ts

14 lines
414 B
TypeScript
Raw Normal View History

2022-04-16 13:30:25 +08:00
import log from './log'
2022-03-19 17:03:29 +08:00
import path from 'path'
import { app } from 'electron'
2022-04-02 00:45:20 +08:00
import { createDirIfNotExist } from './utils'
2022-03-19 17:03:29 +08:00
2022-03-30 00:53:05 +08:00
const isDev = process.env.NODE_ENV === 'development'
2022-03-19 17:03:29 +08:00
if (isDev) {
2022-05-12 02:45:43 +08:00
const devUserDataPath = path.resolve(process.cwd(), '../../tmp/userData')
2022-04-02 00:45:20 +08:00
createDirIfNotExist(devUserDataPath)
2022-03-19 17:03:29 +08:00
app.setPath('appData', devUserDataPath)
}
2022-04-16 13:30:25 +08:00
log.info(`[index] userData path: ${app.getPath('userData')}`)