mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-26 03:18:52 -06:00
refactor: index the database by path once
model.database.record_at and sha1_at read one cached path index with normpath keys. They replace records_by_path of resolve.packfiles, the manifest's own sha1 index, the per-call indexes of regionaudit, emulatorcheck and hidden_extras, and the linear scan of held_record. resolve_sha1 drops its by_path argument. A path spelled with ./ or a doubled slash now finds its record everywhere; the database writes none, so the output is the same.
This commit is contained in:
1 parent
1c978f3083
commit
8bc1fcb5db
9 files changed
+55
-60
No files matched your search
@@ -11,6 +11,7 @@ from dataclasses import dataclass, field
|
||||
from typing import TYPE_CHECKING, TypedDict
|
||||
|
||||
from core.options import reject_unknown
|
||||
from model.database import sha1_at
|
||||
from model.profiles import PROFILE_IDENTITY_FIELDS, entry_system_ids, lists_files
|
||||
from model.systems import norm_system_id
|
||||
from model.alternatives import core_file_spares, required_only_spares, set_fields
|
||||
@@ -415,13 +416,10 @@ def hidden_extras(
|
||||
system_ids = options.get("system_ids")
|
||||
include_all = options.get("include_all", False)
|
||||
required_only = options.get("required_only", False)
|
||||
sha1_by_path = {
|
||||
entry.get("path"): sha1 for sha1, entry in db.get("files", {}).items()
|
||||
}
|
||||
base_dest = config.get("base_destination", "")
|
||||
taken = Placed(bool(config.get("case_insensitive_fs", False)), content={})
|
||||
for dest, local in shipped.items():
|
||||
taken.take(dest, sha1_by_path.get(local))
|
||||
taken.take(dest, sha1_at(db, local))
|
||||
prefix = detect_extras_prefix(config, base_dest)
|
||||
region_prefix = declared_root(config)
|
||||
hidden: dict[tuple[str, str, str], str] = {}
|
||||
@@ -459,7 +457,7 @@ def hidden_extras(
|
||||
local, _status = resolve_local_file(
|
||||
fe, db, dest_hint=fe.get("destination", "")
|
||||
)
|
||||
held = (sha1_by_path.get(local) or _file_sha1(local)) if local else None
|
||||
held = (sha1_at(db, local) or _file_sha1(local)) if local else None
|
||||
if reason == "case_twin" and held and taken.content_at(full) == held:
|
||||
continue
|
||||
key = (
|
||||
|
||||
Reference in new issue
Block a user