From 20b61cfc1624a6e3d3c321239de4df6431381294 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sat, 21 Jun 2025 17:10:28 -0400 Subject: [PATCH] Store GUI config under user data --- gui/README.md | 5 +++++ gui/electron/main.js | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gui/README.md b/gui/README.md index 81e66cd..6591eb3 100644 --- a/gui/README.md +++ b/gui/README.md @@ -14,3 +14,8 @@ npm start The Electron app invokes the `voxvera` binary from your `PATH`. Make sure it is installed before launching the GUI. + +Configuration is stored in your operating system's *user data* directory. +On Linux this defaults to `~/.config/voxvera-gui/config.json`. The first +launch copies a default `config.json` there and subsequent edits via the GUI +update that file. diff --git a/gui/electron/main.js b/gui/electron/main.js index 15706d3..fb11606 100644 --- a/gui/electron/main.js +++ b/gui/electron/main.js @@ -82,7 +82,18 @@ app.whenReady().then(() => { }); function getConfigPath() { - return path.join(__dirname, '..', '..', 'voxvera', 'src', 'config.json'); + const userDir = app.getPath('userData'); + const cfgPath = path.join(userDir, 'config.json'); + if (!fs.existsSync(cfgPath)) { + try { + fs.mkdirSync(userDir, { recursive: true }); + const defaultCfg = path.join(__dirname, '..', '..', 'voxvera', 'src', 'config.json'); + fs.copyFileSync(defaultCfg, cfgPath); + } catch (err) { + dialog.showErrorBox('Config error', err.message); + } + } + return cfgPath; } ipcMain.handle('load-config', async () => {