mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-27 16:10:32 +00:00
save .reticulum config dir next to launched exe when using portable version
This commit is contained in:
parent
5aa90ffae4
commit
3264e63968
1 changed files with 20 additions and 0 deletions
|
|
@ -81,6 +81,21 @@ function getDefaultStorageDir() {
|
|||
|
||||
}
|
||||
|
||||
function getDefaultReticulumConfigDir() {
|
||||
|
||||
// if we are running a windows portable exe, we want to use .reticulum in the portable exe dir
|
||||
// e.g if we launch "E:\Some\Path\MeshChat.exe" we want to use "E:\Some\Path\.reticulum"
|
||||
const portableExecutableDir = process.env.PORTABLE_EXECUTABLE_DIR;
|
||||
if(process.platform === "win32" && portableExecutableDir != null){
|
||||
return path.join(portableExecutableDir, '.reticulum');
|
||||
}
|
||||
|
||||
// otherwise, we will fall back to using the .reticulum folder in the users home directory
|
||||
// e.g: ~/.reticulum
|
||||
return path.join(app.getPath('home'), '.reticulum');
|
||||
|
||||
}
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
|
||||
// create browser window
|
||||
|
|
@ -122,6 +137,11 @@ app.whenReady().then(async () => {
|
|||
// '--test-exception-message', 'Test Exception Message', // uncomment to test the crash dialog
|
||||
];
|
||||
|
||||
// if user didn't provide reticulum config dir, we should provide it
|
||||
if(!userProvidedArguments.includes("--reticulum-config-dir")){
|
||||
requiredArguments.push("--reticulum-config-dir", getDefaultReticulumConfigDir());
|
||||
}
|
||||
|
||||
// if user didn't provide storage dir, we should provide it
|
||||
if(!userProvidedArguments.includes("--storage-dir")){
|
||||
requiredArguments.push("--storage-dir", getDefaultStorageDir());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue