fix: prefer changelog over Game.ini in census sidecar scan

This commit is contained in:
ginnoir committed 2026-08-14 14:51:03 -05:00
1 parent 25eee44483
commit cbe1848d10
5 files changed
+29 -12

No files matched your search

+14 -12
View File
@@ -20,19 +20,21 @@ def _from_text(text: str) -> str | None:
def _sidecar_version(file_path: str) -> str | None:
parent = os.path.dirname(file_path)
for name in os.listdir(parent) if os.path.isdir(parent) else []:
low = name.lower()
if low in CHANGELOG_NAMES or low == "game.ini":
if not os.path.isdir(parent):
return None
names = os.listdir(parent)
for name in names:
if name.lower() in CHANGELOG_NAMES:
with open(os.path.join(parent, name), encoding="utf-8", errors="ignore") as fh:
text = fh.read()
if low == "game.ini":
m = INI_VER.search(text)
if m:
return m.group(1).strip()
else:
found = _from_text(text)
if found:
return found
found = _from_text(fh.read())
if found:
return found
for name in names:
if name.lower() == "game.ini":
with open(os.path.join(parent, name), encoding="utf-8", errors="ignore") as fh:
m = INI_VER.search(fh.read())
if m:
return m.group(1).strip()
return None
def _zip_version(file_path: str) -> str | None: