mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 13:48:41 -09:00
Fix copying default config at launch if needed
This commit is contained in:
parent
81c5829e1b
commit
c827349e83
1 changed files with 6 additions and 4 deletions
|
|
@ -22,7 +22,8 @@ const _importConf = function() {
|
||||||
mkdirpSync(plugs.local);
|
mkdirpSync(plugs.local);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const _defaultCfg = _extractDefault(readFileSync(defaultCfg, 'utf8'));
|
const defaultCfgRaw = readFileSync(defaultCfg, 'utf8');
|
||||||
|
const _defaultCfg = _extractDefault(defaultCfgRaw);
|
||||||
// Importing platform specific keymap
|
// Importing platform specific keymap
|
||||||
try {
|
try {
|
||||||
const content = readFileSync(defaultPlatformKeyPath(), 'utf8');
|
const content = readFileSync(defaultPlatformKeyPath(), 'utf8');
|
||||||
|
|
@ -37,8 +38,8 @@ const _importConf = function() {
|
||||||
const _cfgPath = readFileSync(cfgPath, 'utf8');
|
const _cfgPath = readFileSync(cfgPath, 'utf8');
|
||||||
return {userCfg: _cfgPath, defaultCfg: _defaultCfg};
|
return {userCfg: _cfgPath, defaultCfg: _defaultCfg};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
_write(cfgPath, _defaultCfg);
|
_write(cfgPath, defaultCfgRaw);
|
||||||
return {userCfg: {}, defaultCfg: _defaultCfg};
|
return {userCfg: defaultCfgRaw, defaultCfg: _defaultCfg};
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
//eslint-disable-next-line no-console
|
//eslint-disable-next-line no-console
|
||||||
|
|
@ -49,7 +50,8 @@ const _importConf = function() {
|
||||||
exports._import = () => {
|
exports._import = () => {
|
||||||
const imported = _importConf();
|
const imported = _importConf();
|
||||||
defaultConfig = imported.defaultCfg;
|
defaultConfig = imported.defaultCfg;
|
||||||
return _init(imported);
|
const result = _init(imported);
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getDefaultConfig = () => {
|
exports.getDefaultConfig = () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue