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