refactor: fold destinations with one rule

comparable_destination moves to core.paths. Placed, placement_block,
the shared group merge of model.platforms and LauncherPlace.fold read it
in place of their own lower(). It also trims surrounding blanks and
slashes and folds with casefold: no destination, collection path or
launcher name differs under those rules today, so the output is the
same.
This commit is contained in:
Abdessamad Derraz committed 2026-11-20 20:03:26 +01:00
1 parent ca3ff1d4c5
commit 1c978f3083
7 files changed
+27 -23

No files matched your search

+10
View File
@@ -28,6 +28,16 @@ def sanitize_pack_path(raw: str) -> str:
return "/".join(p for p in raw.split("/") if p and p not in ("..", "."))
def comparable_destination(destination: str, fold: bool = True) -> str:
"""Comparable form of a destination, since layers write it differently.
Case is folded only where the platform's filesystem folds it: on Linux
RetroDECK ships bios/DISK.ROM and bios/disk.rom side by side.
"""
cleaned = destination.strip().strip("/").replace("\\", "/")
return cleaned.casefold() if fold else cleaned
def declared_destination(entry: dict) -> str:
"""The destination a declaration names, its name when it names none,
normalized as sanitize_pack_path does: the key the builder, the manifest