You've already forked iFlow-Settings-Editor-GUI
修复 打包后托盘图标不显示的问题
This commit is contained in:
10
main.js
10
main.js
@@ -11,8 +11,14 @@ const isDev = process.argv.includes('--dev')
|
|||||||
|
|
||||||
// 创建系统托盘
|
// 创建系统托盘
|
||||||
function createTray() {
|
function createTray() {
|
||||||
// 使用内置图标或创建空白图标
|
// 获取图标路径 - 打包后需要从 extraResources 获取
|
||||||
const iconPath = path.join(__dirname, 'build', 'icon.ico')
|
let iconPath
|
||||||
|
if (app.isPackaged) {
|
||||||
|
iconPath = path.join(process.resourcesPath, 'icon', 'icon.ico')
|
||||||
|
} else {
|
||||||
|
iconPath = path.join(__dirname, 'build', 'icon.ico')
|
||||||
|
}
|
||||||
|
|
||||||
let trayIcon
|
let trayIcon
|
||||||
if (fs.existsSync(iconPath)) {
|
if (fs.existsSync(iconPath)) {
|
||||||
trayIcon = nativeImage.createFromPath(iconPath)
|
trayIcon = nativeImage.createFromPath(iconPath)
|
||||||
|
|||||||
@@ -30,6 +30,12 @@
|
|||||||
"output": "release",
|
"output": "release",
|
||||||
"buildResources": "build"
|
"buildResources": "build"
|
||||||
},
|
},
|
||||||
|
"extraResources": [
|
||||||
|
{
|
||||||
|
"from": "build/icon.ico",
|
||||||
|
"to": "icon/icon.ico"
|
||||||
|
}
|
||||||
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"dist/**/*",
|
"dist/**/*",
|
||||||
"main.js",
|
"main.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user