mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-09 07:28:43 +00:00
Store GUI config under user data
This commit is contained in:
@@ -14,3 +14,8 @@ npm start
|
|||||||
|
|
||||||
The Electron app invokes the `voxvera` binary from your `PATH`.
|
The Electron app invokes the `voxvera` binary from your `PATH`.
|
||||||
Make sure it is installed before launching the GUI.
|
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() {
|
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 () => {
|
ipcMain.handle('load-config', async () => {
|
||||||
|
Reference in New Issue
Block a user