From 8e91a9eb0e6cf8c36b26891f0d77b8c1d9beaeb8 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 18 Apr 2026 12:04:02 +0300 Subject: [PATCH] chore(desktop): don't use subdirectory when changing electron path --- apps/desktop/package.json | 6 +++--- apps/desktop/src/main.ts | 2 +- .../User Guide/Installation & Setup/Data directory.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 4ef7b34fd4..ce34d3627a 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -11,16 +11,16 @@ "url": "https://triliumnotes.org" }, "scripts": { - "dev": "cross-env TRILIUM_PORT=37742 TRILIUM_DATA_DIR=data TRILIUM_ELECTRON_DATA_DIR=data-electron tsx ../../scripts/electron-start.mts src/main.ts", + "dev": "cross-env TRILIUM_PORT=37742 TRILIUM_DATA_DIR=data TRILIUM_ELECTRON_DATA_DIR=data-electron-37742 tsx ../../scripts/electron-start.mts src/main.ts", "start-no-dir": "cross-env TRILIUM_PORT=37743 tsx ../../scripts/electron-start.mts src/main.ts", "build": "tsx scripts/build.ts", - "start-prod": "pnpm build && cross-env TRILIUM_DATA_DIR=data TRILIUM_ELECTRON_DATA_DIR=data-electron TRILIUM_PORT=37841 ELECTRON_IS_DEV=0 electron dist", + "start-prod": "pnpm build && cross-env TRILIUM_DATA_DIR=data TRILIUM_ELECTRON_DATA_DIR=data-electron-37841 TRILIUM_PORT=37841 ELECTRON_IS_DEV=0 electron dist", "start-prod-no-dir": "pnpm build && cross-env TRILIUM_PORT=37841 ELECTRON_IS_DEV=0 electron dist", "electron-forge:make": "pnpm build && electron-forge make dist", "electron-forge:make-flatpak": "pnpm build && DEBUG=* electron-forge make dist --targets=@electron-forge/maker-flatpak", "electron-forge:package": "pnpm build && electron-forge package dist", "electron-forge:start": "pnpm build && electron-forge start dist", - "e2e": "pnpm build && cross-env TRILIUM_INTEGRATION_TEST=memory-no-store TRILIUM_PORT=8082 TRILIUM_DATA_DIR=data-e2e TRILIUM_ELECTRON_DATA_DIR=data-e2e-electron ELECTRON_IS_DEV=0 playwright test" + "e2e": "pnpm build && cross-env TRILIUM_INTEGRATION_TEST=memory-no-store TRILIUM_PORT=8082 TRILIUM_DATA_DIR=data-e2e TRILIUM_ELECTRON_DATA_DIR=data-e2e-electron-8082 ELECTRON_IS_DEV=0 playwright test" }, "dependencies": { "@electron/remote": "2.1.3", diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index fce70adb2d..508e7be7e7 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -107,7 +107,7 @@ async function main() { */ function getUserData() { if (process.env.TRILIUM_ELECTRON_DATA_DIR) { - return resolve(process.env.TRILIUM_ELECTRON_DATA_DIR, `electron-data-${port}`); + return resolve(process.env.TRILIUM_ELECTRON_DATA_DIR); } return join(app.getPath("appData"), `${app.getName()}-${port}`); diff --git a/docs/User Guide/User Guide/Installation & Setup/Data directory.md b/docs/User Guide/User Guide/Installation & Setup/Data directory.md index 3e02d48b4b..3e80a27be1 100644 --- a/docs/User Guide/User Guide/Installation & Setup/Data directory.md +++ b/docs/User Guide/User Guide/Installation & Setup/Data directory.md @@ -81,7 +81,7 @@ You can then save the above command as a shell script on your path for convenien When running the desktop application, Electron stores internal data (caches, spell-check dictionaries, session storage, etc.) separately from the Trilium data directory. By default this goes to the system's application data folder (e.g. `%APPDATA%` on Windows), which may be undesirable in corporate environments with roaming profiles or when running in portable mode. -To keep Electron data out of the system's roaming profile, set the `TRILIUM_ELECTRON_DATA_DIR` environment variable to an explicit path. The `trilium-portable` script does this automatically, pointing it to `trilium-electron-data/` next to the application. A subdirectory named `electron-data-[port]` is created inside it to allow multiple instances to coexist. +To keep Electron data out of the system's roaming profile, set the `TRILIUM_ELECTRON_DATA_DIR` environment variable to an explicit path. The `trilium-portable` script does this automatically, pointing it to `trilium-electron-data/` next to the application. ## Fine-grained directory/path location @@ -95,4 +95,4 @@ Apart from the data directory, some of the subdirectories of it can be moved els | `TRILIUM_TMP_DIR` | `${TRILIUM_DATA_DIR}/tmp` | Directory where temporary files are stored (for example when opening in an external app). | | `TRILIUM_ANONYMIZED_DB_DIR` | `${TRILIUM_DATA_DIR}/anonymized-db` | Directory where a Anonymized Database is stored. | | `TRILIUM_CONFIG_INI_PATH` | `${TRILIUM_DATA_DIR}/config.ini` | Path to Configuration (config.ini or environment variables) file. | -| `TRILIUM_ELECTRON_DATA_DIR` | System appData | Base directory for Electron internal data (caches, spell-check dictionaries, etc.). A `electron-data-[port]` subdirectory is created inside it. Set this in portable mode to avoid writing to the system profile (desktop only). | \ No newline at end of file +| `TRILIUM_ELECTRON_DATA_DIR` | System appData | Directory for Electron internal data (caches, spell-check dictionaries, etc.). Set this in portable mode to avoid writing to the system profile (desktop only). | \ No newline at end of file