mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
app run integrated to command.js
This commit is contained in:
@@ -146,8 +146,8 @@ _TVDOS.variables = {
|
||||
DOSDIR: "\\tvdos",
|
||||
LANG: "EN",
|
||||
KEYBOARD: "us_qwerty",
|
||||
PATH: "\\tvdos\\bin;\\tbas;\\home",
|
||||
PATHEXT: ".com;.bat;.js",
|
||||
PATH: "\\tvdos\\bin;\\home",
|
||||
PATHEXT: ".com;.bat;.app;.js",
|
||||
HELPPATH: "\\tvdos\\help",
|
||||
OS_NAME: "TSVM Disk Operating System",
|
||||
OS_VERSION: _TVDOS.VERSION
|
||||
@@ -177,12 +177,20 @@ class TVDOSFileDescriptor {
|
||||
}
|
||||
else {
|
||||
let p = path0.replaceAll("/", "\\")
|
||||
// oh well...
|
||||
this._driveLetter = p[0]
|
||||
p = p.substring(2) // detaches A:
|
||||
// remove trailing slashes
|
||||
while (p.endsWith("\\")) {
|
||||
p = p.substring(0, p.length - 1)
|
||||
}
|
||||
this._driveLetter = p[0]
|
||||
this._path = p.substring(2) // detaches $:
|
||||
// remove initial slashes...
|
||||
while (p.startsWith("\\")) {
|
||||
p = p.substring(1)
|
||||
}
|
||||
// then add our own
|
||||
p = "\\" + p
|
||||
|
||||
this._path = p
|
||||
|
||||
if (driverID == undefined) driverID = "UNDEFINED"
|
||||
|
||||
@@ -276,6 +284,12 @@ class TVDOSFileDescriptor {
|
||||
get name() {
|
||||
return this.path.split("\\").last()
|
||||
}
|
||||
get extension() {
|
||||
let fname = this.name
|
||||
let dotpos = fname.lastIndexOf('.')
|
||||
if (dotpos < 0) return ''
|
||||
else return fname.substring(dotpos+1)
|
||||
}
|
||||
get parentPath() {
|
||||
// return this.path.split("\\").init().join("\\")
|
||||
let li = this.path.lastIndexOf("\\")
|
||||
|
||||
@@ -733,10 +733,7 @@ shell.execute = function(line) {
|
||||
}
|
||||
else {
|
||||
let programCode = searchFile.sread()
|
||||
let extension = undefined
|
||||
// get proper extension
|
||||
let dotSepTokens = cmd.split('.')
|
||||
if (dotSepTokens.length > 1) extension = dotSepTokens[dotSepTokens.length - 1].toUpperCase()
|
||||
let extension = searchFile.extension.toUpperCase()
|
||||
|
||||
if ("BAT" == extension) {
|
||||
// parse and run as batch file
|
||||
@@ -745,6 +742,13 @@ shell.execute = function(line) {
|
||||
shell.execute(line)
|
||||
})
|
||||
}
|
||||
else if ("APP" == extension) {
|
||||
let appexec = `A:${_TVDOS.variables.DOSDIR}\\sbin\\appexec.js`
|
||||
let foundFile = searchFile.fullPath
|
||||
|
||||
// println(`${appexec} ${foundFile} ${parsedTokens.tail().join(' ')}`)
|
||||
shell.execute(`${appexec} ${foundFile} ${parsedTokens.tail().join(' ')}`)
|
||||
}
|
||||
else {
|
||||
let gotError = false
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ for (let i = 0; i < sectionTable.length - 1; i++) {
|
||||
}
|
||||
}
|
||||
|
||||
let errorlevel = _G.shell.execute(PATH_MOUNT + "run.com")
|
||||
let errorlevel = _G.shell.execute(PATH_MOUNT + "run.com" + " " + exec_args.tail().join(' '))
|
||||
|
||||
try {
|
||||
files.open(PATH_MOUNT).remove()
|
||||
@@ -197,7 +197,7 @@ class TevdDiskDrive(private val vm: VM, private val driveNum: Int, theTevdPath:
|
||||
else {
|
||||
val inputString = inputData.trimNull().toString(VM.CHARSET)
|
||||
|
||||
println("[TevDiskDrive] $inputString")
|
||||
// println("[TevDiskDrive] $inputString")
|
||||
|
||||
if (inputString.startsWith("DEVRST\u0017")) {
|
||||
printdbg("Device Reset")
|
||||
|
||||
Reference in New Issue
Block a user