1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-02-12 09:03:00 +01:00
upscayl/electron/binaries.ts

26 lines
866 B
TypeScript
Raw Normal View History

2022-09-07 08:01:28 +05:30
/*
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-12 02:09:28 +05:30
import { join, dirname, resolve } from "path";
2022-11-12 02:17:00 +05:30
import getPlatform from "./getPlatform";
2022-11-12 02:09:28 +05:30
import isDev from "electron-is-dev";
import { app } from "electron";
2022-09-25 16:45:43 +05:30
const appRootDir = app.getAppPath();
2022-08-16 07:47:27 +05:30
2022-08-23 19:47:16 +05:30
const binariesPath = isDev
2022-11-12 02:09:28 +05:30
? join(appRootDir, "resources", getPlatform()!, "bin")
2022-09-25 16:45:43 +05:30
: join(dirname(appRootDir), "bin");
2022-08-16 07:47:27 +05:30
2022-09-11 15:57:47 +05:30
const execPath = (execName) =>
resolve(join(binariesPath, `./upscayl-${execName}`));
2022-09-07 08:01:28 +05:30
const modelsPath = isDev
2022-09-25 16:45:43 +05:30
? resolve(join(appRootDir, "resources", "models"))
: resolve(join(dirname(appRootDir), "models"));
2022-08-16 07:47:27 +05:30
2022-11-12 02:09:28 +05:30
export { execPath, modelsPath };