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

+1 -10
View File
@@ -7,21 +7,12 @@ import zlib
from dataclasses import dataclass, field
from core.hashing import compute_hashes, parse_hash_list, parse_md5_list
from core.paths import comparable_destination
from core.ziptools import check_inside_zip
from resolve.localfile import resolve_local_file, variant_base_name
from resolve.packfiles import records_by_path, preferred_entries
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
@dataclass
class Collision:
"""One destination a platform fills with two different files."""