fix: carry a profile destination into the truth

A profile states where the code reads a file as path: or destination:,
and the resolver reads both. The truth copied path only: redream's
dc_bios.bin, read at dc/boot.bin, reached the export with no path, so
System.dat's dc/boot.bin was not seen and a dc_bios.bin line was added,
and Batocera got bios/dc_bios.bin instead of bios/dc/boot.bin.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 14:24:05 +02:00
1 parent 181ad0c630
commit 9bcfa049ba
2 files changed
+20

No files matched your search

+5
View File
@@ -155,6 +155,11 @@ def _merge_file_into_system(
Dolphin's three IPL.bin differ only by GC/USA, GC/EUR, GC/JAP. Under
one path or none, its declarations are revisions of one file.
"""
# A profile states where the code reads a file as `path:` or as
# `destination:` (redream's dc_bios.bin at dc/boot.bin), as the resolver
# reads them.
if not file_entry.get("path") and file_entry.get("destination"):
file_entry = {**file_entry, "path": file_entry["destination"]}
files = system.setdefault("files", [])
existing = _same_file(files, file_entry, emu_name)
if existing is None:
+15
View File
@@ -120,6 +120,21 @@ class OneNameSeveralFiles(unittest.TestCase):
self.assertEqual(_diff_system(self._system(), scraped), {})
class ADestinationIsThePath(unittest.TestCase):
def test_a_profile_destination_reaches_the_truth(self):
"""redream names its BIOS dc_bios.bin and reads it at dc/boot.bin.
The truth dropped `destination:`, so the export never saw that
System.dat declares dc/boot.bin and added a dc_bios.bin line."""
system: dict = {}
_merge_file_into_system(system, {"name": "dc_bios.bin",
"destination": "dc/boot.bin",
"md5": "a" * 32}, "redream", None)
self.assertEqual(system["files"][0]["path"], "dc/boot.bin")
scraped = {"files": [{"name": "dc/boot.bin", "destination": "dc/boot.bin",
"md5": "a" * 32}]}
self.assertEqual(_diff_system(system, scraped), {})
class DifferentContentsStayApart(unittest.TestCase):
def test_two_cores_same_name_different_contents(self):
"""beebem's BBC BIOS.rom and np2kai's PC-98 bios.rom merged into one."""