From 2c9b51f29de03eb756826df4ba2c5bdd684f8f26 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 9 Apr 2019 05:37:53 +0200 Subject: [PATCH] Add support for custom profile directory A custom user data directory can now be specified using the "profile-dir" command line argument. Github ref: closes #6175 Signed-off-by: Pacien TRAN-GIRARD --- README.md | 2 ++ electron_app/src/electron-main.js | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e64c7a74a..8003bd84c 100644 --- a/README.md +++ b/README.md @@ -250,6 +250,8 @@ Desktop app configuration To run multiple instances of the desktop app for different accounts, you can launch the executable with the `--profile` argument followed by a unique identifier, e.g `riot-web --profile Work` for it to run a separate profile and not interfere with the default one. +Alternatively, a custom location for the profile data can be specified using the `--profile-dir` flag followed by the desired path. + To change the config.json for the desktop app, create a config file which will be used to override values in the config which ships in the package: + `%APPDATA%\$NAME\config.json` on Windows + `$XDG_CONFIG_HOME\$NAME\config.json` or `~/.config/$NAME/config.json` on Linux diff --git a/electron_app/src/electron-main.js b/electron_app/src/electron-main.js index e9659070e..9c75123ff 100644 --- a/electron_app/src/electron-main.js +++ b/electron_app/src/electron-main.js @@ -42,7 +42,9 @@ const Store = require('electron-store'); // migrating to mitigate any risk of it being used maliciously. let migratingOrigin = false; -if (argv['profile']) { +if (argv['profile-dir']) { + app.setPath('userData', argv['profile-dir']); +} else if (argv['profile']) { app.setPath('userData', `${app.getPath('userData')}-${argv['profile']}`); }