chore(nx/server): set proper resource dir when run from dist

This commit is contained in:
Elian Doran 2025-04-24 16:08:02 +03:00
parent aa68c705f0
commit aab545b82e
No known key found for this signature in database
2 changed files with 5 additions and 1 deletions

View File

@ -17,7 +17,7 @@
"@electron/rebuild": "3.7.2" "@electron/rebuild": "3.7.2"
}, },
"scripts": { "scripts": {
"start-prod": "nx build desktop && cross-env TRILIUM_DATA_DIR=data electron dist/main.js", "start-prod": "nx build desktop && cross-env TRILIUM_DATA_DIR=data TRILIUM_RESOURCE_DIR=dist electron dist/main.js",
"rebuild": "electron-rebuild" "rebuild": "electron-rebuild"
}, },
"nx": { "nx": {

View File

@ -290,6 +290,10 @@ export function envToBoolean(val: string | undefined) {
* @returns the resource dir. * @returns the resource dir.
*/ */
export function getResourceDir() { export function getResourceDir() {
if (process.env.TRILIUM_RESOURCE_DIR) {
return process.env.TRILIUM_RESOURCE_DIR;
}
if (isElectron && !isDev) return process.resourcesPath; if (isElectron && !isDev) return process.resourcesPath;
if (!isDev) { if (!isDev) {
return path.dirname(process.argv[1]); return path.dirname(process.argv[1]);