Use electron's getPath() API to get the user's app data directory (#2948)

Docs: https://github.com/electron/electron/blob/master/docs/api/app.md#appgetpathname
Closes: https://github.com/zeit/hyper/pull/1960
Fixes: https://github.com/zeit/hyper/issues/1944
This commit is contained in:
Benjamin Staneck 2019-02-25 17:42:09 +01:00 committed by Juan Campa
parent 0d4afdf31d
commit 80bb82122a

View file

@ -1,12 +1,12 @@
// This module exports paths, names, and other metadata that is referenced
const {homedir} = require('os');
const {app} = require('electron');
const {statSync} = require('fs');
const {resolve, join} = require('path');
const isDev = require('electron-is-dev');
const cfgFile = '.hyper.js';
const defaultCfgFile = 'config-default.js';
const homeDir = homedir();
const homeDir = app.getPath('userData');
let cfgPath = join(homeDir, cfgFile);
let cfgDir = homeDir;