From b1bb523ec41036423f13d2c83f9d9d1319fec3a8 Mon Sep 17 00:00:00 2001 From: mattuy Date: Sat, 25 Jul 2020 23:32:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dlinux=E4=B8=8A?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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');