From 00c62a5e05f98d49881f877375d97afe21d2585b Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sat, 25 Sep 2021 14:27:49 +0900 Subject: [PATCH] no rev slash as it always requires escaping --- assets/disk0/tvdos/bin/command.js | 20 ++++++++++---------- assets/disk0/tvdos/bin/flsh.js | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/assets/disk0/tvdos/bin/command.js b/assets/disk0/tvdos/bin/command.js index e6a6d89..59267bc 100644 --- a/assets/disk0/tvdos/bin/command.js +++ b/assets/disk0/tvdos/bin/command.js @@ -31,7 +31,7 @@ function print_prompt_text() { con.color_pair(161,253); con.addch(16);con.curs_right(); con.color_pair(0,253); - print(" \\"+shell_pwd.join("\\").substring(1)+" "); + print(" /"+shell_pwd.join("/").substring(1)+" "); if (errorlevel != 0) { con.color_pair(166,253); print("["+errorlevel+"] "); @@ -44,9 +44,9 @@ function print_prompt_text() { else { con.color_pair(253,255); if (errorlevel != 0) - print(CURRENT_DRIVE + ":\\" + shell_pwd.join("\\") + " [" + errorlevel + "]" + PROMPT_TEXT); + print(CURRENT_DRIVE + ":/" + shell_pwd.join("/") + " [" + errorlevel + "]" + PROMPT_TEXT); else - print(CURRENT_DRIVE + ":\\" + shell_pwd.join("\\") + PROMPT_TEXT); + print(CURRENT_DRIVE + ":/" + shell_pwd.join("/") + PROMPT_TEXT); } } @@ -207,13 +207,13 @@ shell.parse = function(input) { return tokens; } shell.resolvePathInput = function(input) { - // replace slashes into revslashes - var pathstr = input.replaceAll('/','\\\\'); - var startsWithSlash = input.startsWith('\\'); + // replace revslashes into rslashes + var pathstr = input.replaceAll('\\','/'); + var startsWithSlash = input.startsWith('/'); var newPwd = []; // split them into an array while filtering empty elements except for the root 'head' - var ipwd = (startsWithSlash ? [""] : shell_pwd).concat(pathstr.split("\\").filter(function(it) { return (it.length > 0); })); + var ipwd = (startsWithSlash ? [""] : shell_pwd).concat(pathstr.split("/").filter(function(it) { return (it.length > 0); })); serial.println("command.js > resolvePathInput > ipwd = "+ipwd); serial.println("command.js > resolvePathInput > newPwd = "+newPwd); @@ -231,7 +231,7 @@ shell.resolvePathInput = function(input) { }); // construct new pathstr from pwd arr so it will be sanitised - pathstr = newPwd.join('\\').substring(1); + pathstr = newPwd.join('/').substring(1); return { string: pathstr, pwd: newPwd }; } @@ -246,7 +246,7 @@ shell.coreutils = { */ cd: function(args) { if (args[1] === undefined) { - println(CURRENT_DRIVE+":"+shell_pwd.join("\\")); + println(CURRENT_DRIVE+":"+shell_pwd.join("/")); return } var path = shell.resolvePathInput(args[1]) @@ -366,7 +366,7 @@ shell.execute = function(line) { // search through PATH for execution var fileExists = false; - var searchDir = (cmd.startsWith("\\")) ? [""] : ["\\"+shell_pwd.join("\\")].concat(_TVDOS.getPath()); + var searchDir = (cmd.startsWith("/")) ? [""] : ["/"+shell_pwd.join("/")].concat(_TVDOS.getPath()); var pathExt = []; // it seems Nashorn does not like 'let' too much? this line gets ignored sometimes // fill pathExt using %PATHEXT% but also capitalise them diff --git a/assets/disk0/tvdos/bin/flsh.js b/assets/disk0/tvdos/bin/flsh.js index d412de1..798e149 100644 --- a/assets/disk0/tvdos/bin/flsh.js +++ b/assets/disk0/tvdos/bin/flsh.js @@ -11,7 +11,7 @@ function print_prompt_text() { con.color_pair(161,253); con.addch(16);con.curs_right(); con.color_pair(0,253); - print(" \\"+shell_pwd.join("\\")+" "); + print(" /"+shell_pwd.join("/")+" "); con.color_pair(253,255); con.addch(16);con.curs_right(); con.addch(32);con.curs_right();