From 48a81ded3e2bdb49b56e0f6f5cbac49fa1c4913f Mon Sep 17 00:00:00 2001 From: Daniel Wong Date: Sat, 15 Jul 2023 21:47:46 +1000 Subject: [PATCH] Ignore backup assets when applying language specific assets --- higurashiInstaller.py | 2 +- installConfiguration.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/higurashiInstaller.py b/higurashiInstaller.py index 7d5a8435..8ec9e3b7 100644 --- a/higurashiInstaller.py +++ b/higurashiInstaller.py @@ -328,7 +328,7 @@ def _applyLanguageSpecificSharedAssets(self, folderToApply): # We don't use the version stored in self.info.unityVersion because on certain configurations, # the mod itself updates the unity version, causing it to change mid-install. try: - versionString = installConfiguration.getUnityVersion(self.dataDirectory) + versionString = installConfiguration.getUnityVersion(self.dataDirectory, ignoreBackupAssets=True) except Exception as e: # If don't know own unity version, don't attempt to apply any UI print("ERROR (_applyLanguageSpecificSharedAssets()): Failed to retrieve unity version from resources.assets as {}".format(e)) diff --git a/installConfiguration.py b/installConfiguration.py index fd2a44cf..07d2c110 100644 --- a/installConfiguration.py +++ b/installConfiguration.py @@ -19,7 +19,7 @@ def getSHA256(path): m.update(file.read()) return m.hexdigest() -def getUnityVersion(datadir, verbosePrinting=True): +def getUnityVersion(datadir, verbosePrinting=True, ignoreBackupAssets=False): # type: (str, bool) -> str """ Given the datadir of a Higurashi game (like 'HigurashiEp0X_Data'), returns the unity version of the game @@ -40,7 +40,7 @@ def getUnityVersion(datadir, verbosePrinting=True): # For this reason, we make a temporary version of the 'original' resources.assets file as 'resources.assets.backup' when the install starts, # When the upgrade finishes successfully, we delete this temporary file to signify that the upgrade is complete. assetsbundlePath = os.path.join(datadir, "resources.assets.backup") - if not os.path.exists(assetsbundlePath): + if ignoreBackupAssets or (not os.path.exists(assetsbundlePath)): assetsbundlePath = os.path.join(datadir, "resources.assets") if not os.path.exists(assetsbundlePath):