mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-27 16:10:32 +00:00
support providing meshchat command line args to portable electron exe
This commit is contained in:
parent
e71e5623af
commit
a804e16f3d
1 changed files with 16 additions and 3 deletions
|
|
@ -101,11 +101,24 @@ app.whenReady().then(async () => {
|
|||
fs.renameSync(oldStorageDir, storageDir);
|
||||
}
|
||||
|
||||
// spawn executable
|
||||
exeChildProcess = await spawn(exe, [
|
||||
// get arguments passed to application, and remove the provided application path
|
||||
const userProvidedArguments = process.argv.slice(1);
|
||||
|
||||
// arguments we always want to pass in
|
||||
const requiredArguments = [
|
||||
'--headless', // reticulum meshchat usually launches default web browser, we don't want this when using electron
|
||||
'--port', '9337', // FIXME: let system pick a random unused port?
|
||||
'--storage-dir', storageDir,
|
||||
];
|
||||
|
||||
// if user didn't provide storage dir, we should provide it
|
||||
if(!userProvidedArguments.includes("--storage-dir")){
|
||||
requiredArguments.push("--storage-dir", storageDir);
|
||||
}
|
||||
|
||||
// spawn executable
|
||||
exeChildProcess = await spawn(exe, [
|
||||
...requiredArguments, // always provide required arguments
|
||||
...userProvidedArguments, // also include any user provided arguments
|
||||
]);
|
||||
|
||||
// log stdout
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue