diff --git a/src/config.js b/src/config.js index 57af814..b7e4d03 100644 --- a/src/config.js +++ b/src/config.js @@ -1,4 +1,5 @@ const fs = require('fs'); +const path = require('path'); const { promisify } = require('util'); const { debounce } = require('lodash'); @@ -17,8 +18,9 @@ const config = { skipTrayIcon: false }; +let configPath = path.resolve(path.dirname(process.execPath), 'config.json'); try { - let userConfig = fs.readFileSync('./config.json'); + let userConfig = fs.readFileSync(configPath); if (userConfig) { Object.assign(config, JSON.parse(userConfig.toString())); } @@ -28,7 +30,7 @@ catch { } async function flushConfig() { const flush = promisify(fs.writeFile.bind(fs)); try { - await flush('./config.json', JSON.stringify(config, null, 4)); + await flush(configPath, JSON.stringify(config, null, 4)); } catch { const { notify } = require('./tools');