Fix problems finding root files in cat and ns.read

Cat ends up translating the path it receives from relative to absolute twice, which I fix by changing the filename to an absolute path before it's passed to getTextFile with a leading "/" so that it doesn't interpret the filename as being relative.

Read I fixed by causing getTextFile to remove the leading "/" from files that are in the root directory, since that is required to translate their name into the native "filesystem"s format.
This commit is contained in:
Nicholas Colclasure
2021-12-17 19:59:41 -08:00
parent eb002d655a
commit 8ba5199e54
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ export function cat(
}
}
} else if (filename.endsWith(".txt")) {
const txt = terminal.getTextFile(player, filename);
const txt = terminal.getTextFile(player, "/" + filename);
if (txt != null) {
txt.show();
return;