From 358458a937b68023180d14f787610db75c668c07 Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Sat, 21 Apr 2018 09:04:30 +0700 Subject: [PATCH] Fixed appdata path error --- browser/lib/consts.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/browser/lib/consts.js b/browser/lib/consts.js index 34afad36..2eb9bd39 100644 --- a/browser/lib/consts.js +++ b/browser/lib/consts.js @@ -12,7 +12,15 @@ const themes = fs.readdirSync(themePath) }) themes.splice(themes.indexOf('solarized'), 1, 'solarized dark', 'solarized light') -const snippetFile = path.join(remote.app.getPath('appData'), 'Boostnote', 'snippets.json') +const snippetFile = process.env.NODE_ENV === 'production' + ? path.join(app.getPath('appData'), 'Boostnote', 'snippets.json') + : require('path').resolve(path.join(getAppData(), 'Boostnote', 'snippets.json')) + +function getAppData () { + return process.env.APPDATA || (process.platform == 'darwin' + ? process.env.HOME + 'Library/Preferences' + : '/.config') +} const consts = { FOLDER_COLORS: [