mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-13 12:22:33 -05:00
fix: resolve case collisions on case-insensitive filesystems
Move 17 case-colliding BIOS variants to .variants/ so Windows and macOS clones no longer lose files. Existence-based platforms keep the primary, MD5-based platforms resolve from .variants/. Also fix resolve_local_file zipped_file resolution: when multiple ZIPs share a name, verify the inner ROM exists before accepting a candidate. Fixes adam_fdc.zip resolving to the wrong archive.
This commit is contained in:
990
database.json
990
database.json
File diff suppressed because it is too large
Load Diff
@@ -244,6 +244,22 @@ def resolve_local_file(
|
|||||||
pass
|
pass
|
||||||
if db_md5.lower() in md5_set:
|
if db_md5.lower() in md5_set:
|
||||||
return path, "exact"
|
return path, "exact"
|
||||||
|
# When zipped_file is set, only accept candidates that contain it
|
||||||
|
if zipped_file:
|
||||||
|
valid = []
|
||||||
|
for path, m in candidates:
|
||||||
|
try:
|
||||||
|
with zipfile.ZipFile(path) as zf:
|
||||||
|
inner_names = {n.casefold() for n in zf.namelist()}
|
||||||
|
if zipped_file.casefold() in inner_names:
|
||||||
|
valid.append((path, m))
|
||||||
|
except (zipfile.BadZipFile, OSError):
|
||||||
|
pass
|
||||||
|
if valid:
|
||||||
|
primary = [p for p, _ in valid if "/.variants/" not in p]
|
||||||
|
return (primary[0] if primary else valid[0][0]), "hash_mismatch"
|
||||||
|
# No candidate contains the zipped_file — fall through to step 5
|
||||||
|
else:
|
||||||
primary = [p for p, _ in candidates if "/.variants/" not in p]
|
primary = [p for p, _ in candidates if "/.variants/" not in p]
|
||||||
return (primary[0] if primary else candidates[0][0]), "hash_mismatch"
|
return (primary[0] if primary else candidates[0][0]), "hash_mismatch"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user