2022-09-07 04:31:28 +02:00
|
|
|
/*
|
|
|
|
appRootDir is the resources directory inside the unpacked electron app temp directory.
|
|
|
|
resources contains app.asar file, that contains the main and renderer files.
|
|
|
|
We're putting resources/{os}/bin from project inside resources/bin of electron. Same for the models directory as well.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const { join, dirname, resolve } = require("path");
|
2022-08-16 04:17:27 +02:00
|
|
|
const { getPlatform } = require("./getPlatform");
|
2022-08-23 16:17:16 +02:00
|
|
|
const isDev = require("electron-is-dev");
|
2022-09-25 13:15:43 +02:00
|
|
|
const { app } = require("electron");
|
|
|
|
|
|
|
|
const appRootDir = app.getAppPath();
|
2022-08-16 04:17:27 +02:00
|
|
|
|
2022-08-23 16:17:16 +02:00
|
|
|
const binariesPath = isDev
|
2022-09-25 13:15:43 +02:00
|
|
|
? join(appRootDir, "resources", getPlatform(), "bin")
|
|
|
|
: join(dirname(appRootDir), "bin");
|
2022-08-16 04:17:27 +02:00
|
|
|
|
2022-09-11 12:27:47 +02:00
|
|
|
const execPath = (execName) =>
|
|
|
|
resolve(join(binariesPath, `./upscayl-${execName}`));
|
2022-09-19 18:54:44 +02:00
|
|
|
|
2022-09-07 04:31:28 +02:00
|
|
|
const modelsPath = isDev
|
2022-09-25 13:15:43 +02:00
|
|
|
? resolve(join(appRootDir, "resources", "models"))
|
|
|
|
: resolve(join(dirname(appRootDir), "models"));
|
2022-08-16 04:17:27 +02:00
|
|
|
|
|
|
|
module.exports = { execPath, modelsPath };
|