1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-09-23 19:08:25 +02:00

Broken exec

This commit is contained in:
Feenix 2022-08-23 19:37:40 +05:30
parent c9cf06ca28
commit 3e5a055f7f
4 changed files with 20 additions and 10 deletions

View File

@ -1,14 +1,13 @@
const { join, dirname } = require("path");
const path = require("path");
const { rootPath } = require("electron-root-path");
const { isPackaged } = require("electron-is-packaged");
const { getPlatform } = require("./getPlatform");
const appRootDir = require("app-root-dir");
const IS_PROD = process.env.NODE_ENV === "production";
const binariesPath =
IS_PROD && isPackaged // the path to a bundled electron app.
? path.join(rootPath, "./Contents", "./Resources", "./bin")
: path.join(rootPath, "./resources", getPlatform(), "./bin");
const binariesPath = IS_PROD
? join(dirname(appRootDir.get()), "..", "Resources", "bin")
: join(appRootDir.get(), "resources", getPlatform(), "bin");
const execPath = path.resolve(path.join(binariesPath, "./upscayl"));
const modelsPath = path.resolve(path.join(binariesPath, "./models"));

View File

@ -1,10 +1,11 @@
// Native
const { join, parse } = require("path");
const { join, parse, dirname } = 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");
@ -21,11 +22,13 @@ 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,
@ -108,6 +111,7 @@ ipcMain.on(commands.UPSCAYL, async (event, payload) => {
const fileExt = parse(fullfileName).ext;
// UPSCALE
console.log("EXEC: ", execPath);
let upscayl = spawn(
execPath,
[

View File

@ -33,7 +33,8 @@
"start": "electron .",
"build": "next build renderer && next export renderer",
"pack-app": "npm run build && electron-builder --dir",
"dist": "npm run build && electron-builder -l --publish always"
"dist": "npm run build && electron-builder",
"publish": "GH_TOKEN=<> npm run build && electron-builder -l --publish always"
},
"build": {
"productName": "Upscayl",
@ -48,8 +49,8 @@
]
},
{
"from": "resources",
"to": "resources",
"from": "resources/${os}/bin",
"to": "resources/Resources/bin",
"filter": [
"**/*"
]
@ -84,6 +85,7 @@
"tailwindcss": "^3.1.8"
},
"dependencies": {
"app-root-dir": "^1.0.2",
"electron-is-dev": "^2.0.0",
"electron-is-packaged": "^1.0.2",
"electron-next": "^3.1.5",

View File

@ -360,6 +360,11 @@ app-builder-lib@23.3.3:
tar "^6.1.11"
temp-file "^3.4.0"
app-root-dir@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/app-root-dir/-/app-root-dir-1.0.2.tgz#38187ec2dea7577fff033ffcb12172692ff6e118"
integrity sha512-jlpIfsOoNoafl92Sz//64uQHGSyMrD2vYG5d8o2a4qGvyNCvXur7bzIsWtAC/6flI2RYAp3kv8rsfBtaLm7w0g==
app-root-path@>=2.0.1:
version "3.0.0"
resolved "https://registry.npmjs.org/app-root-path/-/app-root-path-3.0.0.tgz"