From 06ec11a1073ac420b8aa4439661c6bf2fc5dcfa7 Mon Sep 17 00:00:00 2001 From: theit8514 Date: Wed, 22 Dec 2021 12:32:47 -0500 Subject: [PATCH] Fix cp from another folder to current folder src is already passed through getFilepath. Doing it again roots the file in the current directory. --- src/Terminal/commands/cp.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Terminal/commands/cp.ts b/src/Terminal/commands/cp.ts index 9f2e48c61..021e9c60d 100644 --- a/src/Terminal/commands/cp.ts +++ b/src/Terminal/commands/cp.ts @@ -43,17 +43,16 @@ export function cp( terminal.error("src and dst must have the same extension."); return; } - const filename = terminal.getFilepath(src); - if (!isScriptFilename(filename) && !filename.endsWith(".txt")) { + if (!isScriptFilename(src) && !src.endsWith(".txt")) { terminal.error("cp only works for scripts and .txt files"); return; } // Scp for txt files - if (filename.endsWith(".txt")) { + if (src.endsWith(".txt")) { let txtFile = null; 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]; break; } @@ -80,7 +79,7 @@ export function cp( // Get the current script let sourceScript = null; 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]; break; }