Skip to content

Commit 3625d2f

Browse files
save file
1 parent 7ae70a6 commit 3625d2f

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

utils/misc/nodejs-terminal/v2.0/nodejs-terminal-v2.0.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@
281281
var term;
282282
var shell;
283283
var cwd;
284+
var user_dir;
285+
var cwd_initial;
286+
var cwd_abs;
284287

285288

286289
var blank;
@@ -760,8 +763,22 @@
760763
if(i1!==undefined){
761764
var i2 = line.indexOf('\x1b[39m');
762765
if(i1<i2){
763-
cwd = line.slice(i1,i2);
764-
console.log('[ cwd ]',cwd);
766+
var dir = line.slice(i1,i2)+'/';
767+
if(cwd_initial===undefined){
768+
cwd_initial = dir.replace('~','/home');
769+
console.log('[ cwd_initial ]',cwd_initial);
770+
user_dir = dir.slice(2);
771+
console.log('[ user_dir ]',user_dir);
772+
}
773+
if(cwd.startsWith('~')){
774+
cwd_abs = dir.replace('~','/home');
775+
}else{
776+
cwd_abs = dir;
777+
}
778+
779+
cwd = dir.slice(cwd_abs.length-1);
780+
console.log('[ cwd ]',cwd);
781+
console.log('[ cwd_abs ]',cwd_abs);
765782
}
766783
}
767784
}

0 commit comments

Comments
 (0)