Fixed bug with rm terminal and ns commands that made non-exe files with .exe in their name undeletable.

This commit is contained in:
Mason Dechaineux 2019-02-25 07:20:56 +10:00 committed by danielyxie
parent f1e43a86db
commit b26568bf7d
2 changed files with 2 additions and 2 deletions

@ -2261,7 +2261,7 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, `Invalid server specified for rm(): ${ip}`);
}
if (fn.includes(".exe")) {
if (fn.endsWith(".exe")) {
for (var i = 0; i < s.programs.length; ++i) {
if (s.programs[i] === fn) {
s.programs.splice(i, 1);

@ -1342,7 +1342,7 @@ let Terminal = {
//Check programs
let delTarget = commandArray[1];
if (delTarget.includes(".exe")) {
if (delTarget.endsWith(".exe")) {
for (let i = 0; i < s.programs.length; ++i) {
if (s.programs[i] === delTarget) {
s.programs.splice(i, 1);