mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-29 12:58:51 -06:00
refactor: read setup display names in one place
This commit is contained in:
1 parent
8f29887bda
commit
be63c6575a
9 files changed
+35
-34
No files matched your search
+14
-10
@@ -54,19 +54,23 @@ def manifest_systems(platform: str) -> frozenset[str]:
|
||||
)
|
||||
|
||||
|
||||
_platform_names: dict[str, str] = {}
|
||||
def display_name(config: dict, name: str) -> str:
|
||||
"""The `platform:` a loaded platform config writes, else its key."""
|
||||
return str(config.get("platform") or name)
|
||||
|
||||
|
||||
def platform_display(name: str) -> str:
|
||||
def platform_display(name: str, platforms_dir: str | None = None) -> str:
|
||||
"""A setup's name as its platform file writes it: Batocera, not batocera."""
|
||||
display = _platform_names.get(name)
|
||||
if display is None:
|
||||
try:
|
||||
config = load_platform_config(name, str(siteinputs.current().platforms))
|
||||
except FileNotFoundError:
|
||||
config = {}
|
||||
display = _platform_names[name] = str(config.get("platform") or name)
|
||||
return display
|
||||
return _platform_display_in(platforms_dir or str(siteinputs.current().platforms), name)
|
||||
|
||||
|
||||
@functools.cache
|
||||
def _platform_display_in(platforms_dir: str, name: str) -> str:
|
||||
try:
|
||||
config = load_platform_config(name, platforms_dir)
|
||||
except FileNotFoundError:
|
||||
config = {}
|
||||
return display_name(config, name)
|
||||
|
||||
|
||||
def comes_with_app(f: dict) -> bool:
|
||||
|
||||
Reference in new issue
Block a user