Corrected paths

This commit is contained in:
Florian Rappl
2023-04-04 17:26:52 +02:00
parent 42e816e85c
commit 2910833e61

View File

@@ -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;