BUGFIX: ns.mv writes to destination file even if it cannot delete source file (#2267)

This commit is contained in:
catloversg
2025-07-25 12:38:55 +07:00
committed by GitHub
parent 8f69a6c0ee
commit fee75b44d4

View File

@@ -1619,11 +1619,13 @@ export const ns: InternalAPI<NSFull> = {
() =>
`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,