Fixed path bug

This commit is contained in:
Feenix
2022-08-23 19:47:16 +05:30
parent 3e5a055f7f
commit 3649ee7d4e
3 changed files with 7 additions and 10 deletions

View File

@@ -2,12 +2,11 @@ const { join, dirname } = require("path");
const path = require("path");
const { getPlatform } = require("./getPlatform");
const appRootDir = require("app-root-dir");
const isDev = require("electron-is-dev");
const IS_PROD = process.env.NODE_ENV === "production";
const binariesPath = IS_PROD
? join(dirname(appRootDir.get()), "..", "Resources", "bin")
: join(appRootDir.get(), "resources", getPlatform(), "bin");
const binariesPath = isDev
? join(appRootDir.get(), "resources", getPlatform(), "bin")
: join(dirname(appRootDir.get()), "..", "Resources", "bin");
const execPath = path.resolve(path.join(binariesPath, "./upscayl"));
const modelsPath = path.resolve(path.join(binariesPath, "./models"));

View File

@@ -1,11 +1,10 @@
// Native
const { join, parse, dirname } = require("path");
const { join, parse } = require("path");
const { format } = require("url");
const { spawn } = require("child_process");
const fs = require("fs");
const sizeOf = require("image-size");
const { autoUpdater } = require("electron-updater");
const appRootDir = require("app-root-dir");
const { execPath, modelsPath } = require("./binaries");
@@ -22,13 +21,11 @@ const isDev = require("electron-is-dev");
const prepareNext = require("electron-next");
const commands = require("./commands");
const sharp = require("sharp");
const { getPlatform } = require("./getPlatform");
// Prepare the renderer once the app is ready
let mainWindow;
app.on("ready", async () => {
await prepareNext("./renderer");
console.log("PATH: ", join(dirname(appRootDir.get()), "Resources", "bin"));
mainWindow = new BrowserWindow({
width: 1100,
@@ -111,6 +108,7 @@ ipcMain.on(commands.UPSCAYL, async (event, payload) => {
const fileExt = parse(fullfileName).ext;
// UPSCALE
console.log("PRODUCTION? :", isDev);
console.log("EXEC: ", execPath);
let upscayl = spawn(
execPath,

View File

@@ -50,7 +50,7 @@
},
{
"from": "resources/${os}/bin",
"to": "resources/Resources/bin",
"to": "Resources/bin",
"filter": [
"**/*"
]