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.
|
|
|
|
*/
|
|
|
|
|
2022-11-11 21:39:28 +01:00
|
|
|
import { join, dirname, resolve } from "path";
|
2022-11-11 21:47:00 +01:00
|
|
|
import getPlatform from "./getPlatform";
|
2022-11-11 21:39:28 +01:00
|
|
|
import isDev from "electron-is-dev";
|
|
|
|
import { app } from "electron";
|
2022-09-25 13:15:43 +02:00
|
|
|
|
|
|
|
const appRootDir = app.getAppPath();
|
2022-08-16 04:17:27 +02:00
|
|
|
|
2022-08-23 16:17:16 +02:00
|
|
|
const binariesPath = isDev
|
2022-11-11 21:39:28 +01:00
|
|
|
? join(appRootDir, "resources", getPlatform()!, "bin")
|
2022-09-25 13:15:43 +02:00
|
|
|
: 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
|
|
|
|
2022-11-11 21:39:28 +01:00
|
|
|
export { execPath, modelsPath };
|