DOS apps to use _G.shell.resolvePathInput for opening a file

This commit is contained in:
minjaesong
2022-09-24 01:51:57 +09:00
parent c598b6633d
commit f9eecab830
5 changed files with 6 additions and 12 deletions

View File

@@ -25,8 +25,6 @@ else {
println("File to edit?"); println("File to edit?");
filename = read(); filename = read();
} }
let driveLetter = _G.shell.getCurrentDrive();
let filePath = _G.shell.getPwdString() + filename;
let contentChanged = false; let contentChanged = false;
@@ -41,7 +39,7 @@ let bulletinShown = false;
let cursoringCol = 0; let cursoringCol = 0;
// load existing file if it's there // 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 let editingExistingFile = file.exists
if (editingExistingFile) { if (editingExistingFile) {
textbuffer = file.sread().split("\n") textbuffer = file.sread().split("\n")

View File

@@ -13,9 +13,9 @@ else {
return 0; 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) { if (!file.exists) {
printerrln(_G.shell.resolvePathInput(filename).string+": cannot open"); printerrln(file.fullPath+": cannot open");
return 1; return 1;
} }

View File

@@ -40,7 +40,7 @@ else {
let file = files.open(`${_G.shell.resolvePathInput(filename).full}`) let file = files.open(`${_G.shell.resolvePathInput(filename).full}`)
if (!file.exists) { if (!file.exists) {
printerrln(_G.shell.resolvePathInput(filename).string+": cannot open"); printerrln(file.fullPath+": cannot open");
return 1; return 1;
} }

View File

@@ -10,10 +10,8 @@ else {
println("File to print out?") println("File to print out?")
filename = read() 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) { if (!file.exists) {
printerrln("File not found") printerrln("File not found")

View File

@@ -8,10 +8,8 @@ if (exec_args[1] === undefined) {
return 1; 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 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) { if (!file.exists) {
printerrln("TOUCH: Can't open "+file.fullPath+" due to IO error"); printerrln("TOUCH: Can't open "+file.fullPath+" due to IO error");
return 1; return 1;