From fee75b44d4d4f4d52fcf2914a94317fdee3fd351 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Fri, 25 Jul 2025 12:38:55 +0700 Subject: [PATCH] BUGFIX: ns.mv writes to destination file even if it cannot delete source file (#2267) --- src/NetscriptFunctions.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index ad23c9921..b95aa0474 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -1619,11 +1619,13 @@ export const ns: InternalAPI = { () => `ERROR: Failed. Was unable to remove file ${sourcePath} from its original location. If ${sourcePath} is a script, make sure that it is NOT running before trying to use 'mv' on it.`, ); + return; } const { overwritten } = server.writeToContentFile(destinationPath, sourceContentFile.content); - if (overwritten) helpers.log(ctx, () => `WARNING: Overwriting file ${destinationPath} on ${host}`); + if (overwritten) { + helpers.log(ctx, () => `WARNING: Overwriting file ${destinationPath} on ${host}`); + } helpers.log(ctx, () => `Moved ${sourcePath} to ${destinationPath} on ${host}`); - return; }, getResetInfo: () => () => ({ lastAugReset: Player.lastAugReset,