From 48997325f35611cc9212f7d6c1764f7b3a281403 Mon Sep 17 00:00:00 2001 From: Daniel Wong Date: Sat, 15 Jul 2023 20:39:44 +1000 Subject: [PATCH] Don't use stored unity version when applying Translation UI (.languagespecificassets files) See #9 and #215 --- higurashiInstaller.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/higurashiInstaller.py b/higurashiInstaller.py index 349ee544..8d5acbbf 100644 --- a/higurashiInstaller.py +++ b/higurashiInstaller.py @@ -316,13 +316,18 @@ def _applyLanguageSpecificSharedAssets(self, folderToApply): Returns False if there was an error during the proccess. If no asset file was found to apply, this is not considered an error (it's assumed the existing sharedassets0.assets is the correct one)""" - # If don't know own unity version, don't attempt to apply any UI - if self.info.unityVersion is None: + # Get the unity version (again) from the existing resources.assets file + # 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) + 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)) print("ERROR: can't apply UI file as don't know own unity version!") return False # Use the sharedassets file with matching os/unityversion if provided by the language patch - versionString = self.info.unityVersion osString = common.Globals.OS_STRING if self.isWine: osString = "windows"