Prevent crash due to renamed files not being able to re-launch automatically
This commit is contained in:
omuretsu 2023-05-25 18:15:32 -04:00
parent f75c185d39
commit 7f6b96fda0

@ -668,8 +668,11 @@ function evaluateVersionCompatibility(ver: string | number): void {
anyPlayer.lastNodeReset = anyPlayer.lastUpdate - anyPlayer.playtimeSinceLastBitnode; anyPlayer.lastNodeReset = anyPlayer.lastUpdate - anyPlayer.playtimeSinceLastBitnode;
} }
Terminal.warn("Migrating to 2.3.0, loading with no scripts.");
const newDirectory = resolveDirectory("v2.3FileChanges/") as Directory; const newDirectory = resolveDirectory("v2.3FileChanges/") as Directory;
for (const server of GetAllServers()) { for (const server of GetAllServers()) {
// Do not load saved scripts on migration
server.savedScripts = [];
let invalidScriptCount = 0; let invalidScriptCount = 0;
// There was a brief dev window where Server.scripts was already a map but the filepath changes weren't in yet. // There was a brief dev window where Server.scripts was already a map but the filepath changes weren't in yet.
const oldScripts = Array.isArray(server.scripts) ? (server.scripts as Script[]) : [...server.scripts.values()]; const oldScripts = Array.isArray(server.scripts) ? (server.scripts as Script[]) : [...server.scripts.values()];