From 2910833e6142de6232ede0d2a0ca0f6ca7fb8f91 Mon Sep 17 00:00:00 2001 From: Florian Rappl Date: Tue, 4 Apr 2023 17:26:52 +0200 Subject: [PATCH] Corrected paths --- src/ElectronNET.Host/src/main.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ElectronNET.Host/src/main.ts b/src/ElectronNET.Host/src/main.ts index 3f78234..736ffa0 100644 --- a/src/ElectronNET.Host/src/main.ts +++ b/src/ElectronNET.Host/src/main.ts @@ -43,11 +43,14 @@ const manifestJsonFileName = app.commandLine.hasSwitch("manifest") : "electron.manifest.json"; const watchable = app.commandLine.hasSwitch("watch"); +const isAsar = __dirname.includes("app.asar"); // if watch is enabled lets change the path const currentBinPath = watchable - ? resolve(__dirname, "../../") - : resolve(__dirname, "../../", "bin"); + ? resolve(__dirname, "../../..") + : isAsar + ? resolve(__dirname, "../../bin") + : resolve(__dirname, "../bin"); const hostHookScriptFilePath = resolve(__dirname, "host-hook.js"); const manifestJsonFilePath = resolve(currentBinPath, manifestJsonFileName); @@ -160,9 +163,11 @@ function isSplashScreenEnabled() { } function startSplashScreen() { + const file = manifestJsonFile.splashscreen.imageFile; + const imageFile = resolve( currentBinPath, - manifestJsonFile.splashscreen.imageFile + file.startsWith("/") ? file.substring(1) : file ); imageSize(imageFile, (error, dimensions) => { @@ -192,7 +197,7 @@ function startSplashScreen() { }); const loadSplashscreenUrl = - resolve(__dirname, "splashscreen", "index.html") + + resolve(__dirname, "..", "splashscreen", "index.html") + "?imgPath=" + imageFile;