Merge pull request #90 from PR0M3TH3AN/codex/update-config-path-logic-in-main.js

Store GUI config in user data folder
This commit is contained in:
thePR0M3TH3AN
2025-06-21 17:10:42 -04:00
committed by GitHub
2 changed files with 17 additions and 1 deletions

View File

@@ -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.

View File

@@ -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 () => {