fix: name an unanswered directory by its path

This commit is contained in:
Abdessamad Derraz committed 2026-11-19 20:23:54 +01:00
1 parent b4b4ddffb5
commit 56290f3bb7
3 files changed
+28 -14

No files matched your search

+11 -11
View File
@@ -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",
+6 -3
View File
@@ -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,
+11
View File
@@ -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."""