mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-17 17:03:27 -05:00
fix: hold a collected directory in the gap report
This commit is contained in:
1 parent
11b679252b
commit
f22d4dfda1
2 files changed
+31
No files matched your search
@@ -21,6 +21,7 @@ from pathlib import Path
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from common import (
|
||||
_norm_system_id,
|
||||
directory_members,
|
||||
get_mame_clone_map,
|
||||
list_registered_platforms,
|
||||
load_database,
|
||||
@@ -294,6 +295,13 @@ def entry_source(f: dict, index: dict) -> str | None:
|
||||
db_files = index["db_files"]
|
||||
fname = f.get("name", "")
|
||||
path_field = f.get("path") or ""
|
||||
# A directory is held when the collection holds files under it, the rule
|
||||
# the pack and verify --emulator expand it by: a bare-name lookup missed
|
||||
# cdogs' .wolf3d/, whose 695 files every pack carries.
|
||||
if f.get("type") == "directory" and directory_members(
|
||||
{"indexes": {"by_path_suffix": by_path_suffix}}, path_field or fname
|
||||
):
|
||||
return "bios"
|
||||
for candidate in [fname, *([path_field] if path_field != fname else []),
|
||||
*(f.get("aliases") or [])]:
|
||||
if not candidate:
|
||||
|
||||
@@ -192,6 +192,29 @@ class CrossReferenceReadsADirectory(DirectoryFixture):
|
||||
self.assertEqual(paths.count("rtp/2000/Music/b.mid"), 1)
|
||||
|
||||
|
||||
class GapReportReadsADirectory(DirectoryFixture):
|
||||
"""The gap report looked a directory up by bare name in an index that
|
||||
drops dot-names: cdogs' .wolf3d/, 695 files every pack carries, was
|
||||
listed as a file to source."""
|
||||
|
||||
def test_a_held_hidden_directory_is_held(self):
|
||||
from cross_reference import entry_source
|
||||
|
||||
self._add("Engine/cdogs/data/.wolf3d/N3D.cdogscpn/campaign.json", b"campaign")
|
||||
db = self._db()
|
||||
index = {
|
||||
"by_name": db["indexes"]["by_name"], "by_name_lower": {},
|
||||
"by_md5": {}, "by_crc32": {}, "by_sha256": {},
|
||||
"by_path_suffix": db["indexes"]["by_path_suffix"],
|
||||
"db_files": db["files"], "data_names": set(),
|
||||
}
|
||||
entry = {"name": ".wolf3d/", "path": "cdogs/data/.wolf3d/", "type": "directory"}
|
||||
self.assertEqual(entry_source(entry, index), "bios")
|
||||
self.assertIsNone(entry_source(
|
||||
{"name": "Fonts", "path": "demo/Fonts/", "type": "directory"}, index
|
||||
))
|
||||
|
||||
|
||||
class PackCarriesADirectory(DirectoryFixture):
|
||||
EXPECTED = {"rtp/2000/Backdrop/a.png", "rtp/2000/Music/b.mid"}
|
||||
|
||||
|
||||
Reference in new issue
Block a user