YesPlayMusic/src/main/preload.ts

14 lines
419 B
TypeScript
Raw Normal View History

2022-03-19 17:03:29 +08:00
import logger from './logger'
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) {
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)
}
logger.info(`[index] userData path: ${app.getPath('userData')}`)