mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
DOS apps to use _G.shell.resolvePathInput for opening a file
This commit is contained in:
@@ -25,8 +25,6 @@ else {
|
||||
println("File to edit?");
|
||||
filename = read();
|
||||
}
|
||||
let driveLetter = _G.shell.getCurrentDrive();
|
||||
let filePath = _G.shell.getPwdString() + filename;
|
||||
|
||||
let contentChanged = false;
|
||||
|
||||
@@ -41,7 +39,7 @@ let bulletinShown = false;
|
||||
let cursoringCol = 0;
|
||||
|
||||
// load existing file if it's there
|
||||
let file = files.open(`${driveLetter}:/${filePath}`)
|
||||
let file = files.open(`${_G.shell.resolvePathInput(filename).full}`)
|
||||
let editingExistingFile = file.exists
|
||||
if (editingExistingFile) {
|
||||
textbuffer = file.sread().split("\n")
|
||||
|
||||
@@ -13,9 +13,9 @@ else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let file = files.open(`${_G.shell.getCurrentDrive()}:/${_G.shell.resolvePathInput(filename).string}`)
|
||||
let file = files.open(`${_G.shell.resolvePathInput(filename).full}`)
|
||||
if (!file.exists) {
|
||||
printerrln(_G.shell.resolvePathInput(filename).string+": cannot open");
|
||||
printerrln(file.fullPath+": cannot open");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ else {
|
||||
|
||||
let file = files.open(`${_G.shell.resolvePathInput(filename).full}`)
|
||||
if (!file.exists) {
|
||||
printerrln(_G.shell.resolvePathInput(filename).string+": cannot open");
|
||||
printerrln(file.fullPath+": cannot open");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,8 @@ else {
|
||||
println("File to print out?")
|
||||
filename = read()
|
||||
}
|
||||
let driveLetter = _G.shell.getCurrentDrive()
|
||||
let filePath = _G.shell.getPwdString() + filename
|
||||
|
||||
let file = files.open(`${driveLetter}:${filePath}`)
|
||||
let file = files.open(`${_G.shell.resolvePathInput(filename).full}`)
|
||||
|
||||
if (!file.exists) {
|
||||
printerrln("File not found")
|
||||
|
||||
@@ -8,10 +8,8 @@ if (exec_args[1] === undefined) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
let path = _G.shell.resolvePathInput(exec_args[2] || exec_args[1]).string;
|
||||
let driveLetter = _G.shell.getCurrentDrive();
|
||||
let noNewFile = (exec_args[1] == "/c" || exec_args[1] == "/C");
|
||||
let file = files.open(`${driveLetter}:/${path}`)
|
||||
let file = files.open(`${_G.shell.resolvePathInput(exec_args[2] || exec_args[1]).full}`)
|
||||
if (!file.exists) {
|
||||
printerrln("TOUCH: Can't open "+file.fullPath+" due to IO error");
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user