mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
more chdir wip
This commit is contained in:
@@ -69,6 +69,16 @@ filesystem.readAll = function(driveLetter) {
|
||||
}
|
||||
return com.pullMessage(port[0]);
|
||||
};
|
||||
filesystem.isDirectory = function(driveLetter) {
|
||||
let port = filesystem._toPorts(driveLetter);
|
||||
com.sendMessage(port[0], "LISTFILES");
|
||||
let response = com.getStatusCode(port[0]);
|
||||
|
||||
if (135 == response) {
|
||||
throw Error("File not opened");
|
||||
}
|
||||
return (response === 0);
|
||||
}
|
||||
Object.freeze(filesystem);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -138,9 +138,22 @@ shell.coreutils = {
|
||||
return
|
||||
}
|
||||
|
||||
// replace slashes into revslashes
|
||||
let pathstr = args[1].replaceAll('/','\\\\');
|
||||
// split them into an array while filtering empty elements except for the root 'head'
|
||||
let newPwd = [""].concat(pathstr.split("\\").filter(function(it) { return (it.length > 0); }));
|
||||
// construct new pathstr from pwd arr so it will be sanitised
|
||||
pathstr = newPwd.join('\\').substring(1);
|
||||
|
||||
if (DEBUG_PRINT) serial.println("command.js > pathstr = "+pathstr);
|
||||
|
||||
// check if path is valid
|
||||
let dirOpened = filesystem.open(CURRENT_DRIVE, pathstr, 'R');
|
||||
if (!dirOpened) { printerrln("CHDIR failed for '"+pathstr+"'"); return; }
|
||||
|
||||
// check if path is directory
|
||||
let isDir = filesystem.isDirectory(CURRENT_DRIVE);
|
||||
if (!isDir) { printerrln("CHDIR failed for '"+pathstr+"'"); return; }
|
||||
|
||||
shell_pwd = newPwd;
|
||||
},
|
||||
|
||||
@@ -365,6 +365,8 @@ class TestDiskDrive(private val driveNum: Int, theRootPath: File? = null) : Bloc
|
||||
|
||||
// applies a "cap" if the path attemps to access parent directory of the root
|
||||
private fun filterSuperRoot(path: String): String {
|
||||
if (path.isEmpty()) return path
|
||||
|
||||
var parentCount = 0
|
||||
val paths = path.split('/')
|
||||
val newPaths = ArrayList<String>()
|
||||
|
||||
@@ -29,7 +29,7 @@ class V2kRunTest(val appConfig: LwjglApplicationConfiguration) : ApplicationAdap
|
||||
override fun create() {
|
||||
super.create()
|
||||
|
||||
gpu = GraphicsAdapter(vm, lcdMode = false)
|
||||
gpu = GraphicsAdapter(vm, theme = GraphicsAdapter.THEME_COLORCRT)
|
||||
|
||||
vm.peripheralTable[1] = PeripheralEntry(
|
||||
VM.PERITYPE_GPU_AND_TERM,
|
||||
|
||||
Reference in New Issue
Block a user