mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-08 06:58:42 +00:00
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:
@@ -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.
|
||||
|
@@ -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 () => {
|
||||
|
Reference in New Issue
Block a user