1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-12-01 02:27:16 +01:00
upscayl/electron/utils/get-resource-paths.ts
2023-10-14 06:30:49 +05:30

25 lines
871 B
TypeScript

import { join, dirname, resolve } from "path";
import { getPlatform } from "./get-device-specs";
import isDev from "electron-is-dev";
import { app } from "electron";
/**
* 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 appRootDir = app.getAppPath();
const binariesPath = isDev
? join(appRootDir, "resources", getPlatform()!, "bin")
: join(dirname(appRootDir), "bin");
const execPath = (execName) => resolve(join(binariesPath, `./upscayl-bin`));
const modelsPath = isDev
? resolve(join(appRootDir, "resources", "models"))
: resolve(join(dirname(appRootDir), "models"));
export { execPath, modelsPath };