From 645a485daac2756a3143eae61edb1b5ffd9abce6 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Tue, 19 May 2020 10:52:39 +0200 Subject: [PATCH] Fix config path not correct on all platforms --- package.json | 1 + src/Config.js | 4 ++-- yarn.lock | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a449719..79bbcea 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { + "appdata-path": "^1.0.0", "ejs": "^3.0.1", "electron-updater": "^4.2.4", "esm": "^3.2.25", diff --git a/src/Config.js b/src/Config.js index c45d658..c599f6d 100644 --- a/src/Config.js +++ b/src/Config.js @@ -1,11 +1,11 @@ import fs from "fs"; import path from "path"; -import {homedir} from "os"; +import getAppDataPath from "appdata-path"; import Service from "./Service"; import Meta from "./Meta"; -const configDir = Meta.isDevMode() ? path.resolve(homedir(), '.config/tabs-app-dev') : path.resolve(homedir(), '.config/tabs-app'); +const configDir = Meta.isDevMode() ? getAppDataPath('tabs-app-dev') : getAppDataPath('tabs-app'); const configFile = path.resolve(configDir, 'config.json'); export default class Config { diff --git a/yarn.lock b/yarn.lock index 8c519c9..7611e64 100644 --- a/yarn.lock +++ b/yarn.lock @@ -169,6 +169,11 @@ app-builder-lib@22.6.1: semver "^7.3.2" temp-file "^3.3.7" +appdata-path@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/appdata-path/-/appdata-path-1.0.0.tgz#c4022d0b6727d1ddc1dd7ecec143d4352f3eefad" + integrity sha512-ZbH3ezXfnT/YE3NdqduIt4lBV+H0ybvA2Qx3K76gIjQvh8gROpDFdDLpx6B1QJtW7zxisCbpTlCLhKqoR8cDBw== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"