From 292427c275cfad9458be23b3326fd18d9437c387 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 18 Jun 2019 16:12:38 +0100 Subject: [PATCH] Move default Electron icons outside asar Electron doesn't seem to want to load icons from within `asar`s, so this changes the default icons (used for window and tray) so that they are just regular files on disk and updates the reference to match. Part of https://github.com/vector-im/riot-web/issues/9897 --- electron_app/src/electron-main.js | 5 ++++- package.json | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index 9c75123ff2..8b837caec2 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -295,7 +295,10 @@ app.on('ready', () => { console.log('No update_base_url is defined: auto update is disabled'); } - const iconPath = `${__dirname}/../img/riot.${process.platform === 'win32' ? 'ico' : 'png'}`; + // It's important to call `path.join` so we don't end up with the packaged + // asar in the final path. + const iconFile = `riot.${process.platform === 'win32' ? 'ico' : 'png'}`; + const iconPath = path.join(__dirname, "..", "..", "img", iconFile); // Load the previous window state with fallback to defaults const mainWindowState = windowStateKeeper({ diff --git a/package.json b/package.json index 96458d7bf3..531f5d4a05 100644 --- a/package.json +++ b/package.json @@ -156,10 +156,10 @@ "electronVersion": "4.2.4", "files": [ "node_modules/**", - "src/**", - "img/**" + "src/**" ], "extraResources": [ + { "from": "electron_app/img", "to": "img" }, "webapp/**/*", "origin_migrator/**/*" ],