Skip to content

Commit 1214a78

Browse files
committed
Try to apply correct UI variant if more than one match
1 parent 5f2d19b commit 1214a78

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

higurashiInstaller.py

+19-4
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,30 @@ def _applyLanguageSpecificSharedAssets(self, folderToApply):
308308
osString = "windows"
309309
print("Language Patch UI: Proton/Wine detected! Forcing install of Windows sharedassets0.assets.")
310310

311+
# TODO: use the sharedassets0.assets.backup to determine store name?
312+
# For now, only differentiate steam/non-steam
313+
# Or if can prove that it's always steam+mangagamer and gog, then can leave as-is
314+
if self.isSteam:
315+
print("Language Patch UI: Assuming store is Steam/Mangagamer")
316+
storeName = 'steam'
317+
else:
318+
print("Language Patch UI: Assuming store is GOG")
319+
storeName = 'gog'
320+
321+
bestAltUIPath = None
311322
for altUIFilename in os.listdir(folderToApply):
312323
altUIPath = os.path.join(folderToApply, altUIFilename)
313324
_, ext = os.path.splitext(altUIFilename)
314325
if ext.lower() == '.assets' or ext.lower() == '.languagespecificassets':
315326
if os.path.isfile(altUIPath) and versionString in altUIFilename.lower() and osString in altUIFilename.lower():
316-
uiPath = path.join(folderToApply, "sharedassets0.assets")
317-
print("Language Patch UI: Will copy UI File {} -> {}".format(altUIPath, uiPath))
318-
shutil.copy(altUIPath, uiPath)
319-
return True
327+
if bestAltUIPath is None or storeName in altUIFilename.lower():
328+
bestAltUIPath = altUIPath
329+
330+
if bestAltUIPath is not None:
331+
uiPath = path.join(folderToApply, "sharedassets0.assets")
332+
print("Language Patch UI: Will copy UI File {} -> {}".format(bestAltUIPath, uiPath))
333+
shutil.copy(bestAltUIPath, uiPath)
334+
return True
320335

321336
print("Language Patch UI: No UI/sharedassets0 found for ({},{}) - using default sharedassets0.assets".format(osString, versionString))
322337
return True

0 commit comments

Comments
 (0)