fix: use correct icon path for tray/window in packaged app
All checks were successful
Build / increment-version (push) Successful in 6s
Build / build-windows (push) Successful in 3m9s
Build / build-linux (push) Successful in 5m0s
Build / create-release (push) Successful in 17s

This commit is contained in:
litruv
2026-02-21 20:05:28 +11:00
parent 448c4c2dfd
commit 59adbcbdf4

View File

@@ -74,6 +74,15 @@ const isDev = process.env.NODE_ENV === 'development' || !app.isPackaged;
const VITE_DEV_SERVER = 'http://localhost:8080';
const PORT = 44548;
// Helper to get correct icon path in dev vs packaged app
function getIconPath(iconName) {
if (isDev) {
return path.join(__dirname, '../icons', iconName);
}
// In packaged app, extraResources puts icons in resources/icons/
return path.join(process.resourcesPath, 'icons', iconName);
}
function createWindow() {
// Restore window state or use defaults
const windowState = store.get('windowState', {
@@ -99,7 +108,7 @@ function createWindow() {
webSecurity: true,
allowRunningInsecureContent: false
},
icon: path.join(__dirname, '../icons', process.platform === 'win32' ? 'icon.ico' : 'icon.png'),
icon: getIconPath(process.platform === 'win32' ? 'icon.ico' : 'icon.png'),
show: false // Don't show until ready
});
@@ -245,7 +254,7 @@ function createWindow() {
}
function createTray() {
const iconPath = path.join(__dirname, '../icons', 'icon.png');
const iconPath = getIconPath('icon.png');
const trayIcon = nativeImage.createFromPath(iconPath);
tray = new Tray(trayIcon.resize({ width: 16, height: 16 }));