mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-13 12:22:33 -05:00
fix: verify functions handle flat zip extraction
This commit is contained in:
@@ -2432,6 +2432,11 @@ def _run_verify_packs(args):
|
|||||||
with zipfile.ZipFile(zip_path) as zf:
|
with zipfile.ZipFile(zip_path) as zf:
|
||||||
zf.extractall(extract_dir)
|
zf.extractall(extract_dir)
|
||||||
|
|
||||||
|
# Auto-detect flat vs nested extraction
|
||||||
|
is_flat = bool(base_dest) and not os.path.isdir(
|
||||||
|
os.path.join(extract_dir, base_dest)
|
||||||
|
)
|
||||||
|
|
||||||
missing = []
|
missing = []
|
||||||
hash_fail = []
|
hash_fail = []
|
||||||
ok = 0
|
ok = 0
|
||||||
@@ -2442,7 +2447,7 @@ def _run_verify_packs(args):
|
|||||||
continue
|
continue
|
||||||
fp = (
|
fp = (
|
||||||
os.path.join(extract_dir, base_dest, dest)
|
os.path.join(extract_dir, base_dest, dest)
|
||||||
if base_dest
|
if base_dest and not is_flat
|
||||||
else os.path.join(extract_dir, dest)
|
else os.path.join(extract_dir, dest)
|
||||||
)
|
)
|
||||||
# Case-insensitive fallback
|
# Case-insensitive fallback
|
||||||
|
|||||||
@@ -3383,10 +3383,17 @@ class TestE2E(unittest.TestCase):
|
|||||||
registry_path,
|
registry_path,
|
||||||
emulators_dir=self.emulators_dir,
|
emulators_dir=self.emulators_dir,
|
||||||
)
|
)
|
||||||
|
# Detect flat vs nested ZIP to build expected paths
|
||||||
base = manifest.get("base_destination", "")
|
base = manifest.get("base_destination", "")
|
||||||
|
is_flat = bool(base) and not any(
|
||||||
|
n.startswith(base + "/") for n in zip_names
|
||||||
|
)
|
||||||
manifest_dests = set()
|
manifest_dests = set()
|
||||||
for f in manifest["files"]:
|
for f in manifest["files"]:
|
||||||
d = f"{base}/{f['dest']}" if base else f["dest"]
|
if base and not is_flat:
|
||||||
|
d = f"{base}/{f['dest']}"
|
||||||
|
else:
|
||||||
|
d = f["dest"]
|
||||||
manifest_dests.add(d)
|
manifest_dests.add(d)
|
||||||
|
|
||||||
self.assertEqual(manifest_dests, zip_names)
|
self.assertEqual(manifest_dests, zip_names)
|
||||||
|
|||||||
Reference in New Issue
Block a user