Keep homedir as session startup endpoint (#3506)

This commit is contained in:
Philippe Potvin 2019-03-02 17:58:19 -05:00 committed by GitHub
parent 2d399baa87
commit 9581f5d5ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -1,4 +1,5 @@
// This module exports paths, names, and other metadata that is referenced // This module exports paths, names, and other metadata that is referenced
const {homedir} = require('os');
const {app} = require('electron'); const {app} = require('electron');
const {statSync} = require('fs'); const {statSync} = require('fs');
const {resolve, join} = require('path'); const {resolve, join} = require('path');
@ -6,10 +7,12 @@ const isDev = require('electron-is-dev');
const cfgFile = '.hyper.js'; const cfgFile = '.hyper.js';
const defaultCfgFile = 'config-default.js'; const defaultCfgFile = 'config-default.js';
const homeDir = app.getPath('userData'); const homeDirectory = homedir();
let cfgPath = join(homeDir, cfgFile); const applicationDirectory = app.getPath('userData');
let cfgDir = homeDir;
let cfgPath = join(applicationDirectory, cfgFile);
let cfgDir = applicationDirectory;
const devDir = resolve(__dirname, '../..'); const devDir = resolve(__dirname, '../..');
const devCfg = join(devDir, cfgFile); const devCfg = join(devDir, cfgFile);
@ -68,5 +71,6 @@ module.exports = {
plugs, plugs,
yarn, yarn,
cliScriptPath, cliScriptPath,
cliLinkPath cliLinkPath,
homeDirectory
}; };

View file

@ -6,7 +6,7 @@ const fileUriToPath = require('file-uri-to-path');
const isDev = require('electron-is-dev'); const isDev = require('electron-is-dev');
const updater = require('../updater'); const updater = require('../updater');
const toElectronBackgroundColor = require('../utils/to-electron-background-color'); const toElectronBackgroundColor = require('../utils/to-electron-background-color');
const {icon, cfgDir} = require('../config/paths'); const {icon, homeDirectory} = require('../config/paths');
const createRPC = require('../rpc'); const createRPC = require('../rpc');
const notify = require('../notify'); const notify = require('../notify');
const fetchNotifications = require('../notifications'); const fetchNotifications = require('../notifications');
@ -103,7 +103,7 @@ module.exports = class Window {
{ {
rows: 40, rows: 40,
cols: 100, cols: 100,
cwd: process.argv[1] && isAbsolute(process.argv[1]) ? process.argv[1] : cfgDir, cwd: process.argv[1] && isAbsolute(process.argv[1]) ? process.argv[1] : homeDirectory,
splitDirection: undefined, splitDirection: undefined,
shell: cfg.shell, shell: cfg.shell,
shellArgs: cfg.shellArgs && Array.from(cfg.shellArgs) shellArgs: cfg.shellArgs && Array.from(cfg.shellArgs)