2023-10-20 14:23:48 +08:00
|
|
|
/** 在主进程中获取关键信息存储到环境变量中,从而在预加载脚本中及渲染进程中使用 */
|
2023-10-18 11:34:40 +08:00
|
|
|
/** 注意: app.isPackaged 可能被被某些方法改变所以请将该文件放到 main.js 必须位于非依赖项的顶部 */
|
2023-10-21 00:21:18 +08:00
|
|
|
import fixPath from 'fix-path'
|
2023-10-18 11:34:40 +08:00
|
|
|
|
|
|
|
import { app } from 'electron'
|
|
|
|
|
2023-10-21 00:21:18 +08:00
|
|
|
if (process.platform === 'darwin') {
|
|
|
|
fixPath()
|
|
|
|
}
|
|
|
|
|
2023-10-18 11:34:40 +08:00
|
|
|
process.env.IS_PACKAGED = JSON.stringify(app.isPackaged)
|
2023-10-20 14:23:48 +08:00
|
|
|
|
|
|
|
process.env.DESKTOP_PATH = app.getPath('desktop')
|
2023-10-21 16:28:14 +08:00
|
|
|
|
|
|
|
process.env.CWD = process.cwd()
|
2023-10-23 18:14:41 +08:00
|
|
|
|
|
|
|
process.env.LOCALE = process.env.LANG?.split('.')?.[0] || 'zh_CN'
|