mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-06 05:28:31 +09:00
Compare commits
2 Commits
6623ff62bc
...
4e7fe82690
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e7fe82690 | ||
|
|
13eaf1b999 |
@@ -178,6 +178,19 @@ shell.replaceVarCall = function(value) {
|
||||
shell.getPwd = function() { return shell_pwd; }
|
||||
shell.getPwdString = function() { return "\\" + (shell_pwd.concat([""])).join("\\"); }
|
||||
shell.getCurrentDrive = function() { return CURRENT_DRIVE; }
|
||||
shell.runningScriptPaths = []
|
||||
shell.getFilePath = function() {
|
||||
return shell.runningScriptPaths[shell.runningScriptPaths.length - 1]
|
||||
}
|
||||
shell.getFileDir = function() {
|
||||
let p = shell.runningScriptPaths[shell.runningScriptPaths.length - 1]
|
||||
if (p === undefined) return undefined
|
||||
let lastSlash = Math.max(p.lastIndexOf('\\'), p.lastIndexOf('/'))
|
||||
if (lastSlash < 0) return p
|
||||
// root of a drive (e.g. "A:\foo.js" -> "A:\")
|
||||
if (lastSlash === 2 && p[1] === ':') return p.substring(0, 3)
|
||||
return p.substring(0, lastSlash)
|
||||
}
|
||||
// example input: echo "the string" > subdir\test.txt
|
||||
shell.parse = function(input) {
|
||||
let tokens = []
|
||||
@@ -787,6 +800,8 @@ shell.execute = function(line, nameOverride) {
|
||||
let programCode = searchFile.sread()
|
||||
let extension = searchFile.extension.toUpperCase()
|
||||
|
||||
shell.runningScriptPaths.push(searchFile.fullPath)
|
||||
try {
|
||||
if ("BAT" == extension) {
|
||||
// parse and run as batch file
|
||||
var lines = programCode.split('\n').filter(function(it) { return it.length > 0 }) // this return is not shell's return!
|
||||
@@ -879,6 +894,9 @@ shell.execute = function(line, nameOverride) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
shell.runningScriptPaths.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
assets/disk0/tvdos/bin/hop.alias
Normal file
1
assets/disk0/tvdos/bin/hop.alias
Normal file
@@ -0,0 +1 @@
|
||||
hopper $0
|
||||
@@ -11,7 +11,7 @@ const USER_PACKAGE_INCLUDE_DIR = `${USER_BASE_DIR}/include`
|
||||
const MANIFEST_EXT = "hop.per"
|
||||
const MIRROR_LIST_PATH = `${SYSTEM_PACKEAGE_DEF_DIR}/mirrors.list`
|
||||
|
||||
const net = require("A:/tvdos/include/net.mjs")
|
||||
const net = require("net")
|
||||
|
||||
// SYNOPSIS
|
||||
// hopper {search,se} [--provides, --requires, --description, --author] query
|
||||
|
||||
Reference in New Issue
Block a user