diff --git a/src/Config.js b/src/Config.js index dc4c0ff..5650cad 100644 --- a/src/Config.js +++ b/src/Config.js @@ -3,8 +3,9 @@ import path from "path"; import {homedir} from "os"; import Service from "./Service"; +import Meta from "./Meta"; -const configDir = path.resolve(homedir(), '.tabs-app'); +const configDir = Meta.isDevMode() ? path.resolve(homedir(), '.config/tabs-app-dev') : path.resolve(homedir(), '.config/tabs-app'); const configFile = path.resolve(configDir, 'config.json'); export default class Config { @@ -39,6 +40,6 @@ export default class Config { console.log('Saving config'); this.services = this.services.filter(s => s !== null); fs.writeFileSync(configFile, JSON.stringify(this, null, 4)); - console.log('> Config saved'); + console.log('> Config saved to', configFile.toString()); } } \ No newline at end of file diff --git a/src/Meta.js b/src/Meta.js new file mode 100644 index 0000000..4ee96b3 --- /dev/null +++ b/src/Meta.js @@ -0,0 +1,12 @@ +export default class Meta { + static #devMode = null; + + static isDevMode() { + if(this.#devMode === null) { + this.#devMode = process.argv.length > 2 && process.argv[2] === '--dev'; + console.debug('Dev mode:', this.#devMode); + } + + return this.#devMode; + } +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index 12281bb..9a6a5bd 100644 --- a/src/main.js +++ b/src/main.js @@ -2,6 +2,7 @@ import fs from "fs"; import path from "path"; import {app, BrowserWindow, ipcMain, Menu, shell, Tray} from "electron"; +import Meta from "./Meta"; import Config from "./Config"; import Service from "./Service"; @@ -10,7 +11,7 @@ const iconPath = path.resolve(resourcesDir, 'logo.png'); const config = new Config(); -const devMode = process.argv.length > 2 && process.argv[2] === '--dev'; +const devMode = Meta.isDevMode(); // Load icons const brandIcons = listIcons('brands');