mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 01:53:48 +01:00
Fix issue introduced handling files in subdirectories ._.
This commit is contained in:
parent
8ba5199e54
commit
61dde4cfac
@ -185,7 +185,7 @@ export function getDestinationFilepath(destination: string, source: string, cwd:
|
|||||||
return destination;
|
return destination;
|
||||||
} else {
|
} else {
|
||||||
// Append the filename to the directory provided.
|
// Append the filename to the directory provided.
|
||||||
let t_path = removeTrailingSlash(dstDir);
|
const t_path = removeTrailingSlash(dstDir);
|
||||||
const fileName = getFileName(source);
|
const fileName = getFileName(source);
|
||||||
return t_path + "/" + fileName;
|
return t_path + "/" + fileName;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,8 @@ export function cat(
|
|||||||
terminal.error("Incorrect usage of cat command. Usage: cat [file]");
|
terminal.error("Incorrect usage of cat command. Usage: cat [file]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const filename = terminal.getFilepath(args[0] + "");
|
const relative_filename = args[0] + "";
|
||||||
|
const filename = terminal.getFilepath(relative_filename);
|
||||||
if (!filename.endsWith(".msg") && !filename.endsWith(".lit") && !filename.endsWith(".txt")) {
|
if (!filename.endsWith(".msg") && !filename.endsWith(".lit") && !filename.endsWith(".txt")) {
|
||||||
terminal.error(
|
terminal.error(
|
||||||
"Only .msg, .txt, and .lit files are viewable with cat (filename must end with .msg, .txt, or .lit)",
|
"Only .msg, .txt, and .lit files are viewable with cat (filename must end with .msg, .txt, or .lit)",
|
||||||
@ -39,7 +40,7 @@ export function cat(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (filename.endsWith(".txt")) {
|
} else if (filename.endsWith(".txt")) {
|
||||||
const txt = terminal.getTextFile(player, "/" + filename);
|
const txt = terminal.getTextFile(player, relative_filename);
|
||||||
if (txt != null) {
|
if (txt != null) {
|
||||||
txt.show();
|
txt.show();
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user