From a35549dc267e9d43384f1742d7ca05eafb6491f1 Mon Sep 17 00:00:00 2001 From: Daniel Wong <1249449+drojf@users.noreply.github.com> Date: Tue, 15 Aug 2023 09:31:57 +1000 Subject: [PATCH] Fix #217 - installer trying to install wrong mod when switching mods - Broken by fb82b1979ad86ad9d4f958d2c1e33d854e402b41 as I did not include the self.targetID as part of the caching key --- fileVersionManagement.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fileVersionManagement.py b/fileVersionManagement.py index 9678ac22..08e68e95 100644 --- a/fileVersionManagement.py +++ b/fileVersionManagement.py @@ -69,7 +69,7 @@ def parseRequirementsList(scanPath, requirementsListString): class VersionManager: - cachedRemoteVersionInfo = None + cachedRemoteVersionInfo = {} localVersionFileName = "installedVersionData.json" def userDidPartialReinstall(self, gameInstallTimeProbePath): """ @@ -114,11 +114,10 @@ def __init__(self, fullInstallConfiguration, modFileList, localVersionFolder, da else: try: # Cache the remote version info to avoid continuously re-downloading it - if VersionManager.cachedRemoteVersionInfo is None: + self.remoteVersionInfo = VersionManager.cachedRemoteVersionInfo.get(self.targetID) + if self.remoteVersionInfo is None: self.remoteVersionInfo = getRemoteVersion(self.targetID) - VersionManager.cachedRemoteVersionInfo = self.remoteVersionInfo - else: - self.remoteVersionInfo = VersionManager.cachedRemoteVersionInfo + VersionManager.cachedRemoteVersionInfo[self.targetID] = self.remoteVersionInfo except Exception as error: self.remoteVersionInfo = None print("VersionManager: Error while retrieving remote version information {}".format(error))