This repository was archived by the owner on Oct 22, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -13,23 +13,25 @@ const url = require("url");
13
13
const fs = require ( "fs" ) ;
14
14
const Terminal = require ( "./classes/terminal.class.js" ) . Terminal ;
15
15
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" ) ;
18
18
19
19
if ( ! fs . existsSync ( settingsFile ) ) {
20
20
fs . writeFileSync ( settingsFile , JSON . stringify ( {
21
21
shell : ( process . platform === "win32" ) ? "powershell.exe" : "bash" ,
22
- keyboard : "en-US"
22
+ keyboard : "en-US" ,
23
+ cwd : electron . app . getPath ( "userData" )
23
24
} ) ) ;
24
25
}
25
26
26
27
app . on ( 'ready' , ( ) => {
27
28
28
- let settings = JSON . parse ( fs . readFileSync ( settingsFile , { encoding : "utf-8" } ) ) ;
29
+ let settings = require ( settingsFile ) ;
29
30
30
31
tty = new Terminal ( {
31
32
role : "server" ,
32
- shell : settings . shell
33
+ shell : settings . shell ,
34
+ cwd : settings . cwd
33
35
} ) ;
34
36
tty . onclosed = ( code , signal ) => {
35
37
console . log ( "=> Terminal exited - " + code + ", " + signal ) ;
Original file line number Diff line number Diff line change 1
1
// Load config
2
- let settings = require ( "./ settings.json") ;
2
+ let settings = require ( require ( 'path' ) . join ( require ( 'electron' ) . remote . app . getPath ( "userData" ) , " settings.json") ) ;
3
3
4
4
let resumeInit , initUI , initMods ;
5
5
let bootScreen = document . getElementById ( "boot_screen" ) ;
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ class Terminal {
61
61
name : 'xterm-color' ,
62
62
cols : 80 ,
63
63
rows : 24 ,
64
- cwd : process . env . PWD ,
64
+ cwd : opts . cwd || process . env . PWD ,
65
65
env : process . env
66
66
} ) ;
67
67
You can’t perform that action at this time.
0 commit comments