mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-12 23:54:04 +09:00
more chdir wip
This commit is contained in:
@@ -69,6 +69,16 @@ filesystem.readAll = function(driveLetter) {
|
|||||||
}
|
}
|
||||||
return com.pullMessage(port[0]);
|
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);
|
Object.freeze(filesystem);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -138,9 +138,22 @@ shell.coreutils = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// replace slashes into revslashes
|
||||||
let pathstr = args[1].replaceAll('/','\\\\');
|
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); }));
|
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;
|
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
|
// applies a "cap" if the path attemps to access parent directory of the root
|
||||||
private fun filterSuperRoot(path: String): String {
|
private fun filterSuperRoot(path: String): String {
|
||||||
|
if (path.isEmpty()) return path
|
||||||
|
|
||||||
var parentCount = 0
|
var parentCount = 0
|
||||||
val paths = path.split('/')
|
val paths = path.split('/')
|
||||||
val newPaths = ArrayList<String>()
|
val newPaths = ArrayList<String>()
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class V2kRunTest(val appConfig: LwjglApplicationConfiguration) : ApplicationAdap
|
|||||||
override fun create() {
|
override fun create() {
|
||||||
super.create()
|
super.create()
|
||||||
|
|
||||||
gpu = GraphicsAdapter(vm, lcdMode = false)
|
gpu = GraphicsAdapter(vm, theme = GraphicsAdapter.THEME_COLORCRT)
|
||||||
|
|
||||||
vm.peripheralTable[1] = PeripheralEntry(
|
vm.peripheralTable[1] = PeripheralEntry(
|
||||||
VM.PERITYPE_GPU_AND_TERM,
|
VM.PERITYPE_GPU_AND_TERM,
|
||||||
|
|||||||
Reference in New Issue
Block a user