diff --git a/install/recalbox.json b/install/recalbox.json index 0831e284c..6b4336eed 100644 --- a/install/recalbox.json +++ b/install/recalbox.json @@ -2101,6 +2101,17 @@ "amiberry-8.2.2" ] }, + { + "dest": "caesar3", + "name": "caesar3/", + "system": "caesar3", + "required": true, + "reason": "not_found", + "cores": [ + "julius" + ], + "category": "game_data" + }, { "dest": "caesar3/The_empire.555", "name": "The_empire.555", @@ -2167,17 +2178,6 @@ ], "category": "game_data" }, - { - "dest": "caesar3/caesar3", - "name": "caesar3/", - "system": "caesar3", - "required": true, - "reason": "not_found", - "cores": [ - "julius" - ], - "category": "game_data" - }, { "dest": "caesar3/goths.555", "name": "goths.555", diff --git a/scripts/packs/extras.py b/scripts/packs/extras.py index a6b433b86..c2a3569eb 100644 --- a/scripts/packs/extras.py +++ b/scripts/packs/extras.py @@ -519,13 +519,16 @@ def _extra_dest(u: dict) -> str: """Where a report entry lands before any platform prefix. An archive entry goes by the archive's name, and a directory path takes - the file's name after it ("cafeLibs/" + "snd_user.rpl"). + the file's name after it ("cafeLibs/" + "snd_user.rpl"). A directory + entry ("registered/") is that path itself. """ archive = u.get("archive") # An archive goes at the root of the core's system directory, which a # platform handing each core its own folder writes in the path. raw = (u.get("path") or archive) if archive else (u.get("path") or u["name"]) - return f"{raw}{u['name']}" if raw.endswith("/") else raw + if not raw.endswith("/") or str(u["name"]).endswith("/"): + return raw + return f"{raw}{u['name']}" def unplaceable_extras( @@ -1732,7 +1735,7 @@ def _second_pass_copy( raw = f.get("standalone_path") or f.get("path") or fname else: raw = system_dir_path(f, f.get("path") or fname) - dest = f"{raw}{fname}" if raw.endswith("/") else raw + dest = f"{raw}{fname}" if raw.endswith("/") and not fname.endswith("/") else raw # A bare name is a destination too: the core reads it at the root # of the directory core files go to, which the platform may not # declare (Recalbox has its System Cards under pcenginecd/ only, diff --git a/tests/test_directory_entries.py b/tests/test_directory_entries.py index c149206e2..b5f3c875f 100644 --- a/tests/test_directory_entries.py +++ b/tests/test_directory_entries.py @@ -311,6 +311,17 @@ class PackCarriesADirectory(DirectoryFixture): self.assertEqual(missing, ["Fonts"]) +class UnansweredDirectoryDestination(unittest.TestCase): + def test_a_directory_gap_is_named_by_its_path(self): + from packs.extras import _extra_dest + + tree = {"name": "registered/", "type": "directory", + "path": "nand/system/Contents/registered/"} + self.assertEqual(_extra_dest(tree), "nand/system/Contents/registered/") + folder = {"name": "snd_user.rpl", "path": "cafeLibs/"} + self.assertEqual(_extra_dest(folder), "cafeLibs/snd_user.rpl") + + @unittest.skipUnless(HAS_JSONSCHEMA, "validating a schema needs jsonschema") class ProfileContract(unittest.TestCase): """One way to say an entry is a directory, so one place reads it."""