优化bug
This commit is contained in:
@@ -16,8 +16,9 @@ app.on("will-finish-launching", () => {
|
||||
preFilePath = process.argv[1] === "." ? "" : process.argv[1];
|
||||
}
|
||||
});
|
||||
const exePath = !app.isPackaged ? process.cwd() : path.dirname(process.execPath)
|
||||
console.log(exePath);
|
||||
// 使用用户数据目录,避免管理员权限问题
|
||||
const exePath = app.getPath('userData')
|
||||
console.log('User data path:', exePath);
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
let size = require("electron").screen.getPrimaryDisplay().workAreaSize;
|
||||
@@ -77,8 +78,11 @@ function createWindow() {
|
||||
event.reply("sys-lan", app.getLocale());
|
||||
});
|
||||
ipcMain.on("open-help-file", (event) => {
|
||||
let fullpath = path.join(exePath, 'help', 'User Manual.pdf')
|
||||
child_process.exec(`start "" "${fullpath}"`);
|
||||
// help 文件在应用目录,不在用户数据目录
|
||||
let helpPath = !app.isPackaged
|
||||
? path.join(process.cwd(), 'help', 'User Manual.pdf')
|
||||
: path.join(path.dirname(process.execPath), 'resources', 'help', 'User Manual.pdf')
|
||||
child_process.exec(`start "" "${helpPath}"`);
|
||||
});
|
||||
|
||||
// 监听从渲染进程发送来的请求
|
||||
|
||||
Reference in New Issue
Block a user