mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 18:59:07 -05:00
fix: publish every config file the installer reads
This commit is contained in:
1 parent
5fccd662bd
commit
8a053d590e
2 files changed
+121
No files matched your search
@@ -180,26 +180,81 @@ platforms:
|
||||
method: config_file
|
||||
config: $HOME/.var/app/org.libretro.RetroArch/config/retroarch/retroarch.cfg
|
||||
parse_key: system_directory
|
||||
- os: linux
|
||||
method: config_file
|
||||
config: $HOME/snap/retroarch/current/.config/retroarch/retroarch.cfg
|
||||
parse_key: system_directory
|
||||
- os: linux
|
||||
method: config_file
|
||||
config: $HOME/.config/retroarch/retroarch.cfg
|
||||
parse_key: system_directory
|
||||
# configuration.c reads <Application Support>/RetroArch/config; a value
|
||||
# left at default is ~/Documents/RetroArch/system (platform_darwin.m).
|
||||
# Older builds kept the file one level up.
|
||||
- os: darwin
|
||||
method: config_file
|
||||
config: $HOME/Library/Application Support/RetroArch/config/retroarch.cfg
|
||||
parse_key: system_directory
|
||||
bios_path: $HOME/Documents/RetroArch/system
|
||||
- os: darwin
|
||||
method: config_file
|
||||
config: $HOME/Library/Application Support/RetroArch/retroarch.cfg
|
||||
parse_key: system_directory
|
||||
bios_path: $HOME/Documents/RetroArch/system
|
||||
# Beside retroarch.exe first, then %APPDATA%; default <exe folder>\system.
|
||||
# The folders its installers, Steam and ES-DE put it in.
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: 'C:\RetroArch-Win64\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: 'C:\RetroArch\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%ProgramFiles%\RetroArch-Win64\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%ProgramFiles%\RetroArch\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%ProgramFiles%\ES-DE\Emulators\RetroArch-Win64\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%ProgramFiles%\ES-DE\Emulators\RetroArch\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%ProgramFiles(x86)%\RetroArch-Win64\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%ProgramFiles(x86)%\RetroArch\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%ProgramFiles(x86)%\ES-DE\Emulators\RetroArch-Win64\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%ProgramFiles(x86)%\ES-DE\Emulators\RetroArch\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%APPDATA%\RetroArch\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%ProgramFiles(x86)%\Steam\steamapps\common\RetroArch\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
- os: windows
|
||||
method: config_file
|
||||
config: '%ProgramFiles%\Steam\steamapps\common\RetroArch\retroarch.cfg'
|
||||
parse_key: system_directory
|
||||
# Handheld firmwares that run RetroArch as their frontend: muOS,
|
||||
# ArkOS, and the stock Linux of Anbernic devices (dmenu).
|
||||
- os: linux
|
||||
@@ -363,6 +418,18 @@ platforms:
|
||||
target_source: null
|
||||
install:
|
||||
detect:
|
||||
# retrodeck.json since the cfg-to-json migration (global.sh:149-153),
|
||||
# retrodeck.cfg before it; a home moved to an SD card lives only there.
|
||||
- os: linux
|
||||
method: config_file
|
||||
config: $HOME/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.json
|
||||
parse_key: paths.rd_home_path
|
||||
bios_path: $HOME/retrodeck
|
||||
- os: linux
|
||||
method: config_file
|
||||
config: $HOME/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.cfg
|
||||
parse_key: rdhome
|
||||
bios_path: $HOME/retrodeck
|
||||
- os: linux
|
||||
method: path_exists
|
||||
path: $HOME/.var/app/net.retrodeck.retrodeck
|
||||
|
||||
@@ -965,6 +965,60 @@ class DetectionFollowsTheRegistry(unittest.TestCase):
|
||||
rules.add((name, "file_exists", tuple(files), rule["bios_path"]))
|
||||
self.assertEqual(set(install._EMBEDDED_RULES), rules)
|
||||
|
||||
def test_every_config_file_read_is_published(self):
|
||||
"""The registry published five RetroArch config files and the fixed
|
||||
RetroDECK folder; the installer also read Snap, the older macOS file,
|
||||
C:\\RetroArch, Program Files, ES-DE, Steam and RetroDECK's own
|
||||
config. A manifest reader saw a subset of what the installer does."""
|
||||
import yaml # noqa: PLC0415
|
||||
|
||||
registry = yaml.safe_load(
|
||||
(Path(__file__).resolve().parents[1] / "platforms" / "_registry.yml").read_text()
|
||||
)
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
env = {
|
||||
"HOME": str(root / "home"), "APPDATA": str(root / "appdata"),
|
||||
"ProgramFiles": str(root / "pf"), "ProgramFiles(x86)": str(root / "pf86"),
|
||||
}
|
||||
|
||||
def expand(text: str) -> str:
|
||||
text = text.replace("$HOME", env["HOME"])
|
||||
for var in ("ProgramFiles(x86)", "ProgramFiles", "APPDATA"):
|
||||
text = text.replace(f"%{var}%", env[var])
|
||||
return str(Path(text.replace("\\", "/")))
|
||||
|
||||
published = {
|
||||
(rule["os"], expand(rule["config"]))
|
||||
for entry in registry["platforms"].values()
|
||||
for rule in (entry.get("install") or {}).get("detect", [])
|
||||
if rule["method"] == "config_file"
|
||||
}
|
||||
read: set[tuple[str, str]] = set()
|
||||
|
||||
def record(os_type: str):
|
||||
def probe(path, *_args, **_kwargs):
|
||||
read.add((os_type, str(Path(str(path).replace("\\", "/")))))
|
||||
return None
|
||||
return probe
|
||||
|
||||
with unittest.mock.patch.dict(os.environ, env), \
|
||||
unittest.mock.patch.object(install, "_detect_embedded", lambda: []), \
|
||||
unittest.mock.patch.object(install, "_detect_android", lambda: []):
|
||||
for os_type in ("linux", "darwin", "windows"):
|
||||
with unittest.mock.patch.object(
|
||||
install, "_parse_retroarch_system_dir", record(os_type)
|
||||
):
|
||||
install.detect_platforms(os_type)
|
||||
with unittest.mock.patch.object(Path, "is_file", lambda _self: True):
|
||||
for folder in install._windows_retroarch_dirs():
|
||||
read.add(("windows", str(folder / "retroarch.cfg")))
|
||||
retrodeck = root / "home/.var/app/net.retrodeck.retrodeck/config/retrodeck"
|
||||
read |= {("linux", str(retrodeck / "retrodeck.json")),
|
||||
("linux", str(retrodeck / "retrodeck.cfg"))}
|
||||
# The default Steam library is the Program Files one, already read.
|
||||
self.assertEqual(sorted(read - published), [])
|
||||
|
||||
def test_the_first_embedded_match_wins(self):
|
||||
with unittest.mock.patch.object(install, "_parse_os_release", return_value={}), \
|
||||
unittest.mock.patch.object(
|
||||
|
||||
Reference in new issue
Block a user