mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-29 23:10:35 +00:00
18 lines
556 B
JavaScript
Vendored
18 lines
556 B
JavaScript
Vendored
const { contextBridge } = require('electron');
|
|
|
|
// 获取数据目录路径(用于显示给用户)
|
|
// 优先使用主进程设置的真实路径,如果没有则回退到手动拼接
|
|
function getDataDirPath() {
|
|
// 如果主进程已设置真实路径,直接使用
|
|
if (process.env.ELECTRON_DATA_DIR) {
|
|
return process.env.ELECTRON_DATA_DIR;
|
|
}
|
|
}
|
|
|
|
contextBridge.exposeInMainWorld('electron', {
|
|
isElectron: true,
|
|
version: process.versions.electron,
|
|
platform: process.platform,
|
|
versions: process.versions,
|
|
dataDir: getDataDirPath()
|
|
}); |