From 138002d7a0613e806d82fcc4d0993da145024378 Mon Sep 17 00:00:00 2001 From: silentrald Date: Mon, 23 Sep 2024 20:58:20 +0800 Subject: [PATCH] [bugfix] show bsm icon properly --- src/main/services/utils.service.ts | 11 ++++++++++- src/main/services/window-manager.service.ts | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/services/utils.service.ts b/src/main/services/utils.service.ts index 4367bd42..a636fe35 100644 --- a/src/main/services/utils.service.ts +++ b/src/main/services/utils.service.ts @@ -8,7 +8,12 @@ import log from "electron-log"; export class UtilsService { private static instance: UtilsService; - private assetsPath: string = app.isPackaged ? path.join(process.resourcesPath, "assets") : path.join(__dirname, "../../assets"); + private assetsPath: string = app.isPackaged + ? path.join(process.resourcesPath, "assets") + : path.join(path.dirname(path.dirname(__dirname)), "assets"); + private readonly buildPath: string = app.isPackaged + ? path.join(process.resourcesPath, "build") + : path.join(path.dirname(path.dirname(__dirname)), "build"); private constructor() {} @@ -36,6 +41,10 @@ export class UtilsService { return path.join(app.getPath("temp"), app.getName()); } + public getBuildPath(filepath: string): string { + return path.join(this.buildPath, filepath); + } + public ipcSend(channel: string, response: IpcResponse): void { try { BrowserWindow.getAllWindows().forEach(window => window?.webContents?.send(channel, response)); diff --git a/src/main/services/window-manager.service.ts b/src/main/services/window-manager.service.ts index 831a97f5..a9854cd5 100644 --- a/src/main/services/window-manager.service.ts +++ b/src/main/services/window-manager.service.ts @@ -25,7 +25,9 @@ export class WindowManagerService { private readonly baseWindowOption: BrowserWindowConstructorOptions = { title: APP_NAME, - icon: this.utilsService.getAssetsPath("favicon.ico"), + icon: process.platform === "linux" + ? this.utilsService.getBuildPath(path.join("icons", "png", "256x256.png")) + : this.utilsService.getBuildPath(path.join("icons", "win", "favicon.ico")), show: false, frame: false, titleBarOverlay: false,