mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-16 16:33:27 -05:00
fix: never copy a path-null entry to a pack root
This commit is contained in:
1 parent
e40d63a7f4
commit
48b00730ff
2 files changed
+53
No files matched your search
@@ -686,6 +686,10 @@ def _collect_emulator_extras(
|
||||
# file; the archive itself is placed by the passes above.
|
||||
if f.get("archive"):
|
||||
continue
|
||||
# No path: the core reads it from nowhere a pack reaches
|
||||
# (Dolphin's codehandler.bin ships in its Sys tree).
|
||||
if "path" in f and f["path"] is None:
|
||||
continue
|
||||
file_mode = f.get("mode")
|
||||
if file_mode == "standalone" and not is_standalone:
|
||||
continue
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
"""An entry with `path: null` is never copied to the root of a pack.
|
||||
|
||||
The pass that copies a file covered elsewhere to each destination a core
|
||||
reads skipped neither: Dolphin's codehandler.bin, which ships in its Sys
|
||||
tree, landed at system/codehandler.bin in RetroArch, Lakka and RetroPie.
|
||||
Reads the repository: skips when the database is absent.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(REPO_ROOT / "scripts"))
|
||||
|
||||
|
||||
class NoPathNoCopy(unittest.TestCase):
|
||||
def test_codehandler_stays_out(self):
|
||||
if not (REPO_ROOT / "database.json").exists():
|
||||
self.skipTest("database.json is not built")
|
||||
previous = os.getcwd()
|
||||
os.chdir(REPO_ROOT)
|
||||
self.addCleanup(os.chdir, previous)
|
||||
from common import load_database, load_emulator_profiles, load_platform_config
|
||||
from packextras import _collect_emulator_extras
|
||||
|
||||
profiles = load_emulator_profiles("emulators")
|
||||
nameless = {
|
||||
(p.get("emulator", n), f["name"])
|
||||
for n, p in profiles.items() for f in p.get("files", [])
|
||||
if isinstance(f, dict) and "path" in f and f["path"] is None
|
||||
}
|
||||
config = load_platform_config("retroarch")
|
||||
extras = _collect_emulator_extras(
|
||||
config, "emulators", load_database("database.json"), set(),
|
||||
config.get("base_destination", ""), profiles,
|
||||
)
|
||||
self.assertEqual(
|
||||
[e["destination"] for e in extras
|
||||
if (e.get("source_emulator"), e["name"]) in nameless],
|
||||
[],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user