imports are more flexible

This commit is contained in:
Olivier Gagnon
2021-12-23 15:55:58 -05:00
parent 16c51e8e8e
commit ed86577d6c
6 changed files with 23 additions and 14 deletions
+3 -1
View File
@@ -13,6 +13,7 @@ import { RamCalculationErrorCode } from "./RamCalculationErrorCodes";
import { RamCosts, RamCostConstants } from "../Netscript/RamCostGenerator";
import { Script } from "../Script/Script";
import { WorkerScript } from "../Netscript/WorkerScript";
import { areImportsEquals } from "../Terminal/DirectoryHelpers";
// These special strings are used to reference the presence of a given logical
// construct within a user script.
@@ -106,8 +107,9 @@ async function parseOnlyRamCalculate(
let script = null;
const fn = nextModule.startsWith("./") ? nextModule.slice(2) : nextModule;
for (const s of otherScripts) {
if (s.filename === fn) {
if (areImportsEquals(s.filename, fn)) {
script = s;
console.log(`${s.filename} ${fn}`);
break;
}
}