2023-10-20 14:23:48 +08:00
|
|
|
/** 在主进程中获取关键信息存储到环境变量中,从而在预加载脚本中及渲染进程中使用 */
|
2024-09-08 01:55:54 +08:00
|
|
|
import { app } from 'electron'
|
|
|
|
|
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
|
|
|
|
2023-10-21 00:21:18 +08:00
|
|
|
if (process.platform === 'darwin') {
|
|
|
|
fixPath()
|
|
|
|
}
|
|
|
|
|
2024-09-09 18:58:17 +08:00
|
|
|
process.env.IS_PACKAGED = String(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()
|
2024-09-09 18:58:17 +08:00
|
|
|
|
|
|
|
export const isPackaged = ['true'].includes(process.env.IS_PACKAGED)
|