mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-02 12:33:56 +01:00
Fix cp from another folder to current folder
src is already passed through getFilepath. Doing it again roots the file in the current directory.
This commit is contained in:
parent
7260d5fe35
commit
06ec11a107
@ -43,17 +43,16 @@ export function cp(
|
|||||||
terminal.error("src and dst must have the same extension.");
|
terminal.error("src and dst must have the same extension.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const filename = terminal.getFilepath(src);
|
if (!isScriptFilename(src) && !src.endsWith(".txt")) {
|
||||||
if (!isScriptFilename(filename) && !filename.endsWith(".txt")) {
|
|
||||||
terminal.error("cp only works for scripts and .txt files");
|
terminal.error("cp only works for scripts and .txt files");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scp for txt files
|
// Scp for txt files
|
||||||
if (filename.endsWith(".txt")) {
|
if (src.endsWith(".txt")) {
|
||||||
let txtFile = null;
|
let txtFile = null;
|
||||||
for (let i = 0; i < server.textFiles.length; ++i) {
|
for (let i = 0; i < server.textFiles.length; ++i) {
|
||||||
if (server.textFiles[i].fn === filename) {
|
if (areFilesEqual(server.textFiles[i].fn, src)) {
|
||||||
txtFile = server.textFiles[i];
|
txtFile = server.textFiles[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -80,7 +79,7 @@ export function cp(
|
|||||||
// Get the current script
|
// Get the current script
|
||||||
let sourceScript = null;
|
let sourceScript = null;
|
||||||
for (let i = 0; i < server.scripts.length; ++i) {
|
for (let i = 0; i < server.scripts.length; ++i) {
|
||||||
if (filename == server.scripts[i].filename) {
|
if (areFilesEqual(server.scripts[i].filename, src)) {
|
||||||
sourceScript = server.scripts[i];
|
sourceScript = server.scripts[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user