fix: place hash-selected files like the platform

The hash-selected pack decided a declaration's place with a string
prefix test on base_destination, so Batocera's bios_CD_U.bin and
bios7.bin stayed at the root of the pack while scph5501.bin went under
bios/. platform_destination in packs/paths.py now places a platform
declaration for the platform pack, the manifest and the --from-md5 pack.
This commit is contained in:
Abdessamad Derraz committed 2026-11-23 21:02:46 +01:00
1 parent 3344cfd2fb
commit d2f4ef6f9c
5 files changed
+56 -12

No files matched your search

+20 -1
View File
@@ -9,10 +9,29 @@ from __future__ import annotations
from collections.abc import Iterable
from dataclasses import dataclass
from core.paths import comparable_destination, sanitize_pack_path
from core.paths import comparable_destination, declared_destination, sanitize_pack_path
from resolve.validation import read_from_save_dir
def under_base(path: str, base_dest: str) -> str:
"""A pack path below the platform's base destination, joined as a path."""
return f"{base_dest}/{path}" if base_dest else path
def platform_destination(entry: dict, base_dest: str) -> tuple[str, str]:
"""(destination, pack path) of a platform declaration.
The destination is the declared one, else the name, made safe. The pack
path puts it below the base destination. Both are empty for a
declaration that names no file. The platform pack, the install manifest
and the hash-selected pack all place a declaration here.
"""
dest = declared_destination(entry)
if not dest:
return "", ""
return dest, under_base(dest, base_dest)
@dataclass(frozen=True)
class SaveLayout:
"""Where a platform's frontend keeps the save directory it hands a core.