app run integrated to command.js

This commit is contained in:
minjaesong
2023-06-16 17:15:48 +09:00
parent a83cdc1a02
commit a46db3f206
4 changed files with 29 additions and 11 deletions

View File

@@ -146,8 +146,8 @@ _TVDOS.variables = {
DOSDIR: "\\tvdos", DOSDIR: "\\tvdos",
LANG: "EN", LANG: "EN",
KEYBOARD: "us_qwerty", KEYBOARD: "us_qwerty",
PATH: "\\tvdos\\bin;\\tbas;\\home", PATH: "\\tvdos\\bin;\\home",
PATHEXT: ".com;.bat;.js", PATHEXT: ".com;.bat;.app;.js",
HELPPATH: "\\tvdos\\help", HELPPATH: "\\tvdos\\help",
OS_NAME: "TSVM Disk Operating System", OS_NAME: "TSVM Disk Operating System",
OS_VERSION: _TVDOS.VERSION OS_VERSION: _TVDOS.VERSION
@@ -177,12 +177,20 @@ class TVDOSFileDescriptor {
} }
else { else {
let p = path0.replaceAll("/", "\\") let p = path0.replaceAll("/", "\\")
// oh well... this._driveLetter = p[0]
p = p.substring(2) // detaches A:
// remove trailing slashes
while (p.endsWith("\\")) { while (p.endsWith("\\")) {
p = p.substring(0, p.length - 1) p = p.substring(0, p.length - 1)
} }
this._driveLetter = p[0] // remove initial slashes...
this._path = p.substring(2) // detaches $: while (p.startsWith("\\")) {
p = p.substring(1)
}
// then add our own
p = "\\" + p
this._path = p
if (driverID == undefined) driverID = "UNDEFINED" if (driverID == undefined) driverID = "UNDEFINED"
@@ -276,6 +284,12 @@ class TVDOSFileDescriptor {
get name() { get name() {
return this.path.split("\\").last() 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() { get parentPath() {
// return this.path.split("\\").init().join("\\") // return this.path.split("\\").init().join("\\")
let li = this.path.lastIndexOf("\\") let li = this.path.lastIndexOf("\\")

View File

@@ -733,10 +733,7 @@ shell.execute = function(line) {
} }
else { else {
let programCode = searchFile.sread() let programCode = searchFile.sread()
let extension = undefined let extension = searchFile.extension.toUpperCase()
// get proper extension
let dotSepTokens = cmd.split('.')
if (dotSepTokens.length > 1) extension = dotSepTokens[dotSepTokens.length - 1].toUpperCase()
if ("BAT" == extension) { if ("BAT" == extension) {
// parse and run as batch file // parse and run as batch file
@@ -745,6 +742,13 @@ shell.execute = function(line) {
shell.execute(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 { else {
let gotError = false let gotError = false

View File

@@ -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 { try {
files.open(PATH_MOUNT).remove() files.open(PATH_MOUNT).remove()

View File

@@ -197,7 +197,7 @@ class TevdDiskDrive(private val vm: VM, private val driveNum: Int, theTevdPath:
else { else {
val inputString = inputData.trimNull().toString(VM.CHARSET) val inputString = inputData.trimNull().toString(VM.CHARSET)
println("[TevDiskDrive] $inputString") // println("[TevDiskDrive] $inputString")
if (inputString.startsWith("DEVRST\u0017")) { if (inputString.startsWith("DEVRST\u0017")) {
printdbg("Device Reset") printdbg("Device Reset")