From f6d1ed0477dbd581a52bcb75b3cb63f5505fa32f Mon Sep 17 00:00:00 2001 From: Lino Schmidt Date: Thu, 7 Jul 2022 11:28:51 +0200 Subject: [PATCH] Fixed icon paths after build --- package.json | 4 +++- src/components/blenderController.ts | 4 ++-- src/components/paths.ts | 4 +++- src/index.ts | 7 +++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 904f137..72a7d95 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,9 @@ ], "extraResources": [ "dependencies/template.blend", - "dependencies/blenderScript.py" + "dependencies/blenderScript.py", + "assets/icon.png", + "assets/render_finished_icon.png" ], "win": { "icon": "assets/icon.png", diff --git a/src/components/blenderController.ts b/src/components/blenderController.ts index 5b64eee..b880267 100644 --- a/src/components/blenderController.ts +++ b/src/components/blenderController.ts @@ -1,4 +1,4 @@ -import { blenderPath, blenderScriptPath, dataPath, templatePath } from "./paths"; +import { blenderPath, blenderScriptPath, dataPath, templatePath, finsishedIconPath } from "./paths"; import {spawn} from "child_process"; import logger from "./logger"; import { setBlenderLoading, setBlenderStatus } from "./ui/menu"; @@ -120,7 +120,7 @@ function startBlender() { // TODO: only show notification if not in do not disturb mode, currently not working. Details: https://github.com/felixrieseberg/macos-notification-state/issues/30 new Notification("Render Finished", { body: "Rendering finished successfully!", - icon: "../assets/render_finished_icon.png" + icon: finsishedIconPath }).onclick = function() { ipcRenderer.send("openApp"); } diff --git a/src/components/paths.ts b/src/components/paths.ts index d01dbdd..ab53202 100644 --- a/src/components/paths.ts +++ b/src/components/paths.ts @@ -18,4 +18,6 @@ export function platformCharacter() { export const blenderPath = path.join(appPath, "dependencies", platformFolder, "blender", "blender"); export const templatePath = path.join(appPath, "dependencies", "template.blend"); -export const blenderScriptPath = path.join(appPath, "dependencies", "blenderScript.py"); \ No newline at end of file +export const blenderScriptPath = path.join(appPath, "dependencies", "blenderScript.py"); + +export const finsishedIconPath = path.join(appPath, "assets", "render_finished_icon.png"); \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 6c53a71..35899f8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,6 +9,9 @@ logger.transports.console.format = "{h}:{i}:{s} {text}"; logger.transports.file.getFile(); logger.transports.file.resolvePath = () => path.join(app.getPath('userData'), "logs", "start.log"); +const appIconPath = path.join(app.getAppPath().replace("app.asar", ""), "assets", "icon.png"); +const finsishedIconPath = path.join(app.getAppPath().replace("app.asar", ""), "assets", "render_finished_icon.png"); + autoUpdater.autoDownload = false; autoUpdater.checkForUpdatesAndNotify(); @@ -116,7 +119,7 @@ const createWindow = () => { const progress = parseFloat(arg); mainWindow.setProgressBar(progress); if(progress === 1 && !mainWindow.isFocused()) { - mainWindow.setOverlayIcon(path.join(__dirname, '../assets/render_finished_icon.png') as unknown as NativeImage, 'Rendering Complete'); + mainWindow.setOverlayIcon(finsishedIconPath as unknown as NativeImage, 'Rendering Complete'); mainWindow.flashFrame(true); } }); @@ -134,7 +137,7 @@ const createWindow = () => { mainWindow.show(); }); - mainWindow.setIcon(path.join(__dirname, '../assets/icon.png')); + mainWindow.setIcon(appIconPath); }; // This method will be called when Electron has finished