mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 18:47:53 -06:00
refactor: walk slot keys from slot_lookup_keys
This commit is contained in:
1 parent
11dac5a641
commit
fd3d93a93f
1 file changed
+4
-8
@@ -128,16 +128,12 @@ def slot_lookup_keys(destination: str, name: str) -> list[str]:
|
||||
|
||||
def lookup_slot(index: dict[str, dict], destination: str, name: str) -> dict | None:
|
||||
"""Look a candidate up, trying the destination then its suffixes then name."""
|
||||
if destination:
|
||||
entry = index.get(destination)
|
||||
*paths, bare = slot_lookup_keys(destination, name)
|
||||
for key in paths:
|
||||
entry = index.get(key)
|
||||
if entry:
|
||||
return entry
|
||||
parts = destination.split("/")
|
||||
for i in range(1, len(parts)):
|
||||
entry = index.get("/".join(parts[i:]))
|
||||
if entry:
|
||||
return entry
|
||||
return index.get(name)
|
||||
return index.get(bare)
|
||||
|
||||
|
||||
def resolve_slot_drops(
|
||||
|
||||
Reference in new issue
Block a user