Use sane location for config (#3584)

This commit is contained in:
Juan Campa 2019-05-06 00:00:50 -04:00 committed by GitHub
parent 7d67b76715
commit 22b5bbb488
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,12 @@ const cfgFile = '.hyper.js';
const defaultCfgFile = 'config-default.js';
const homeDirectory = homedir();
const applicationDirectory = app.getPath('userData');
// If the user defines XDG_CONFIG_HOME they definitely want their config there,
// otherwise use the home directory in linux/mac and userdata in windows
const applicationDirectory =
process.env.XDG_CONFIG_HOME !== undefined
? join(process.env.XDG_CONFIG_HOME, 'hyper')
: process.platform == 'win32' ? app.getPath('userData') : homedir();
let cfgPath = join(applicationDirectory, cfgFile);
let cfgDir = applicationDirectory;