2022-11-11 21:39:28 +01:00
|
|
|
import { join, dirname, resolve } from "path";
|
2023-09-10 11:14:04 +02:00
|
|
|
import { getPlatform } from "./get-device-specs";
|
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
|
|
|
|
2023-09-11 04:28:33 +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-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
|
2023-09-05 20:00:33 +02: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
|
|
|
|
2024-01-16 07:30:07 +01:00
|
|
|
const execPath = resolve(join(binariesPath, `./upscayl-bin`));
|
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 };
|