1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-28 01:10:52 +01: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 path = require("path");
const { rootPath } = require("electron-root-path");
const { isPackaged } = require("electron-is-packaged");
const { getPlatform } = require("./getPlatform"); const { getPlatform } = require("./getPlatform");
const appRootDir = require("app-root-dir");
const IS_PROD = process.env.NODE_ENV === "production"; const IS_PROD = process.env.NODE_ENV === "production";
const binariesPath = const binariesPath = IS_PROD
IS_PROD && isPackaged // the path to a bundled electron app. ? join(dirname(appRootDir.get()), "..", "Resources", "bin")
? path.join(rootPath, "./Contents", "./Resources", "./bin") : join(appRootDir.get(), "resources", getPlatform(), "bin");
: path.join(rootPath, "./resources", getPlatform(), "./bin");
const execPath = path.resolve(path.join(binariesPath, "./upscayl")); const execPath = path.resolve(path.join(binariesPath, "./upscayl"));
const modelsPath = path.resolve(path.join(binariesPath, "./models")); const modelsPath = path.resolve(path.join(binariesPath, "./models"));

View File

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

View File

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

View File

@ -360,6 +360,11 @@ app-builder-lib@23.3.3:
tar "^6.1.11" tar "^6.1.11"
temp-file "^3.4.0" 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: app-root-path@>=2.0.1:
version "3.0.0" version "3.0.0"
resolved "https://registry.npmjs.org/app-root-path/-/app-root-path-3.0.0.tgz" resolved "https://registry.npmjs.org/app-root-path/-/app-root-path-3.0.0.tgz"