Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit c27eadd

Browse files
committed
Fix #29
1 parent 5f82fdf commit c27eadd

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/_boot.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@ const url = require("url");
1313
const fs = require("fs");
1414
const Terminal = require("./classes/terminal.class.js").Terminal;
1515

16-
let win, tty;
17-
let settingsFile = path.join(__dirname, "settings.json");
16+
var win, tty;
17+
const settingsFile = path.join(electron.app.getPath("userData"), "settings.json");
1818

1919
if (!fs.existsSync(settingsFile)) {
2020
fs.writeFileSync(settingsFile, JSON.stringify({
2121
shell: (process.platform === "win32") ? "powershell.exe" : "bash",
22-
keyboard: "en-US"
22+
keyboard: "en-US",
23+
cwd: electron.app.getPath("userData")
2324
}));
2425
}
2526

2627
app.on('ready', () => {
2728

28-
let settings = JSON.parse(fs.readFileSync(settingsFile, {encoding: "utf-8"}));
29+
let settings = require(settingsFile);
2930

3031
tty = new Terminal({
3132
role: "server",
32-
shell: settings.shell
33+
shell: settings.shell,
34+
cwd: settings.cwd
3335
});
3436
tty.onclosed = (code, signal) => {
3537
console.log("=> Terminal exited - "+code+", "+signal);

src/_renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Load config
2-
let settings = require("./settings.json");
2+
let settings = require(require('path').join(require('electron').remote.app.getPath("userData"), "settings.json"));
33

44
let resumeInit, initUI, initMods;
55
let bootScreen = document.getElementById("boot_screen");

src/classes/terminal.class.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Terminal {
6161
name: 'xterm-color',
6262
cols: 80,
6363
rows: 24,
64-
cwd: process.env.PWD,
64+
cwd: opts.cwd || process.env.PWD,
6565
env: process.env
6666
});
6767

0 commit comments

Comments
 (0)