mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
fix: follow moved retrodeck folders under --dest
A run given --platform and --dest never detects, so retrodeck.json was never read and a moved bios/ folder was ignored. MovedFolders looks the root up on first use, is reset per run, and detection only warms it.
This commit is contained in:
1 parent
9f3fc2e0c1
commit
c4a129e200
10 files changed
+177
-54
No files matched your search
+1
-1
@@ -16,7 +16,7 @@
|
||||
# and Invoke-WebRequest throws on a cut transfer before the hash is read:
|
||||
# the site's build rewrites this line there (scripts/sitebootstrap.py).
|
||||
$mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
|
||||
$defaultInstallSha256 = "1c6286c90deb064affd0506cfa7b0c0c4ff19ad1555518f256ac98af86e188e2"
|
||||
$defaultInstallSha256 = "1e45d5dd7b8904b85e9ce9cf30235e818e894b78099569476f0798b8ed4b90d0"
|
||||
# The pin above refuses any changed byte: this cap only stops a body that
|
||||
# cannot be the installer (a sign-in portal's page) before it is hashed.
|
||||
$maximumInstallerBytes = 8MB
|
||||
|
||||
+72
-20
@@ -2655,22 +2655,23 @@ def _safe_target_dir(value: object, field: str) -> str:
|
||||
return value
|
||||
|
||||
|
||||
# A platform whose folders move one by one: root -> {folder under the root:
|
||||
# where it is now}. RetroDECK's per-folder move (RetroDECK 7786a849,
|
||||
# functions/api_data_processing.sh:913-935) records each new place in
|
||||
# retrodeck.json paths.<folder>_path (config/retrodeck/retrodeck.json:3-23),
|
||||
# and its manifest places files under bios/ and roms/ of the home folder.
|
||||
_MOVED_FOLDERS: dict[Path, dict[str, Path]] = {}
|
||||
# RetroDECK's settings folder below the home folder: retrodeck.json since the
|
||||
# cfg-to-json migration, which renames the old retrodeck.cfg to retrodeck.bak
|
||||
# (global.sh:149-153).
|
||||
RETRODECK_CONFIG = Path(".var") / "app" / "net.retrodeck.retrodeck" / "config" / "retrodeck"
|
||||
|
||||
|
||||
def _record_moved_folders(root: Path, retrodeck_json: Path) -> None:
|
||||
"""Each RetroDECK folder that is no longer <home>/<name>."""
|
||||
def _retrodeck_paths(retrodeck_json: Path) -> dict | None:
|
||||
"""The paths table of retrodeck.json, None when it cannot be read."""
|
||||
try:
|
||||
paths = json.loads(retrodeck_json.read_text(encoding="utf-8", errors="replace"))["paths"]
|
||||
except (OSError, ValueError, KeyError, TypeError):
|
||||
return
|
||||
if not isinstance(paths, dict):
|
||||
return
|
||||
return None
|
||||
return paths if isinstance(paths, dict) else None
|
||||
|
||||
|
||||
def _moved_in(root: Path, paths: dict) -> dict[str, Path]:
|
||||
"""Each RetroDECK folder that is no longer <home>/<name>."""
|
||||
moved = {}
|
||||
for key, value in paths.items():
|
||||
name = key[:-len("_path")] if key.endswith("_path") else ""
|
||||
@@ -2678,8 +2679,60 @@ def _record_moved_folders(root: Path, retrodeck_json: Path) -> None:
|
||||
place = Path(value.strip())
|
||||
if place != root / name:
|
||||
moved[name] = place
|
||||
if moved:
|
||||
_MOVED_FOLDERS[root] = moved
|
||||
return moved
|
||||
|
||||
|
||||
class MovedFolders:
|
||||
"""A platform whose folders move one by one: root -> {folder under the
|
||||
root: where it is now}.
|
||||
|
||||
RetroDECK's per-folder move (RetroDECK 7786a849,
|
||||
functions/api_data_processing.sh:913-935) records each new place in
|
||||
retrodeck.json paths.<folder>_path (config/retrodeck/retrodeck.json:3-23),
|
||||
and its manifest places files under bios/ and roms/ of the home folder.
|
||||
A root is looked up on first use, so a run given --dest that never
|
||||
detects places files where a detecting run does; detection only fills
|
||||
the cache ahead.
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._lock = threading.Lock()
|
||||
self._by_root: dict[Path, dict[str, Path]] = {}
|
||||
|
||||
def reset(self) -> None:
|
||||
with self._lock:
|
||||
self._by_root.clear()
|
||||
|
||||
def record(self, root: Path, retrodeck_json: Path) -> None:
|
||||
"""root's moved folders, as retrodeck_json lists them."""
|
||||
paths = _retrodeck_paths(retrodeck_json)
|
||||
with self._lock:
|
||||
self._by_root[root] = _moved_in(root, paths) if paths is not None else {}
|
||||
|
||||
def of(self, root: Path) -> dict[str, Path]:
|
||||
"""root's moved folders: none unless root is RetroDECK's home folder."""
|
||||
with self._lock:
|
||||
known = self._by_root.get(root)
|
||||
if known is not None:
|
||||
return known
|
||||
moved = self._look_up(root)
|
||||
with self._lock:
|
||||
return self._by_root.setdefault(root, moved)
|
||||
|
||||
@staticmethod
|
||||
def _look_up(root: Path) -> dict[str, Path]:
|
||||
home = Path.home()
|
||||
paths = _retrodeck_paths(home / RETRODECK_CONFIG / "retrodeck.json")
|
||||
if paths is None:
|
||||
return {}
|
||||
rd_home = paths.get("rd_home_path")
|
||||
rd_root = Path(rd_home) if isinstance(rd_home, str) and rd_home else home / "retrodeck"
|
||||
if os.path.abspath(rd_root) != os.path.abspath(root):
|
||||
return {}
|
||||
return _moved_in(root, paths)
|
||||
|
||||
|
||||
MOVED = MovedFolders()
|
||||
|
||||
|
||||
# Resolved folder -> the same folder as the run names it: /sdcard is a link
|
||||
@@ -2724,7 +2777,7 @@ def _destination_path(root: Path, value: object) -> Path:
|
||||
emulator reads it.
|
||||
"""
|
||||
relative = _safe_relative_path(value, "dest")
|
||||
moved = _MOVED_FOLDERS.get(root, {})
|
||||
moved = MOVED.of(root)
|
||||
if len(relative.parts) > 1 and relative.parts[0] in moved:
|
||||
return moved[relative.parts[0]].resolve() / Path(*relative.parts[1:])
|
||||
return _note_spelling(root) / Path(*relative.parts)
|
||||
@@ -4989,7 +5042,7 @@ def found_label(plat: str, path: Path) -> str:
|
||||
name = detected_shown(plat, path)
|
||||
shown = display_name(plat)
|
||||
moved = "".join(f", {folder}/ at {place}"
|
||||
for folder, place in sorted(_MOVED_FOLDERS.get(path, {}).items())
|
||||
for folder, place in sorted(MOVED.of(path).items())
|
||||
if folder in ("bios", "roms"))
|
||||
folder = shown_path(setup_bios_folder(plat, path))
|
||||
if not name or name == shown:
|
||||
@@ -5714,9 +5767,7 @@ def _detect_emudeck_unix(found: list[tuple[str, Path]]) -> None:
|
||||
|
||||
def _detect_retrodeck(home: Path, found: list[tuple[str, Path]]) -> None:
|
||||
"""Add RetroDECK's home folder."""
|
||||
# RetroDECK: retrodeck.json since the cfg-to-json migration, which
|
||||
# renames the old retrodeck.cfg to retrodeck.bak (global.sh:149-153)
|
||||
retrodeck_conf_dir = home / ".var" / "app" / "net.retrodeck.retrodeck" / "config" / "retrodeck"
|
||||
retrodeck_conf_dir = home / RETRODECK_CONFIG
|
||||
retrodeck_json = retrodeck_conf_dir / "retrodeck.json"
|
||||
retrodeck_cfg = retrodeck_conf_dir / "retrodeck.cfg"
|
||||
if _exists(retrodeck_json):
|
||||
@@ -5729,7 +5780,7 @@ def _detect_retrodeck(home: Path, found: list[tuple[str, Path]]) -> None:
|
||||
f"{retrodeck_json}: assuming {home / 'retrodeck'}",
|
||||
)
|
||||
rd_root = Path(rd_home) if rd_home else home / "retrodeck"
|
||||
_record_moved_folders(rd_root, retrodeck_json)
|
||||
MOVED.record(rd_root, retrodeck_json)
|
||||
found.append(("retrodeck", rd_root))
|
||||
elif _exists(retrodeck_cfg):
|
||||
rd_home = _parse_bash_var(retrodeck_cfg, "rdhome")
|
||||
@@ -9329,7 +9380,7 @@ def _kept_slot(root: Path, value: object) -> tuple[Path, PurePosixPath]:
|
||||
it, as _destination_path places it: a RetroDECK folder moved elsewhere
|
||||
is its own folder."""
|
||||
relative = _safe_relative_path(value, "dest")
|
||||
moved = _MOVED_FOLDERS.get(root, {})
|
||||
moved = MOVED.of(root)
|
||||
if len(relative.parts) > 1 and relative.parts[0] in moved:
|
||||
return moved[relative.parts[0]].resolve(), PurePosixPath(*relative.parts[1:])
|
||||
return _note_spelling(root), relative
|
||||
@@ -22952,6 +23003,7 @@ class _InstallRun:
|
||||
def _start_install(args: argparse.Namespace, real_stdout: TextIO) -> _InstallRun:
|
||||
"""The run's options completed, its terminal and its local sources opened."""
|
||||
KEPT.reset()
|
||||
MOVED.reset()
|
||||
# A namespace built by a caller that predates --for-games has neither.
|
||||
args.for_games = getattr(args, "for_games", None)
|
||||
args.required_only = getattr(args, "required_only", False)
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/ins
|
||||
# curl or wget stop on a cut transfer before the hash is read: the site's
|
||||
# build rewrites this line there (scripts/sitebootstrap.py).
|
||||
MISMATCH_ADVICE="The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
|
||||
DEFAULT_INSTALL_SHA256="1c6286c90deb064affd0506cfa7b0c0c4ff19ad1555518f256ac98af86e188e2"
|
||||
DEFAULT_INSTALL_SHA256="1e45d5dd7b8904b85e9ce9cf30235e818e894b78099569476f0798b8ed4b90d0"
|
||||
# The pin above refuses any changed byte: this cap only stops a body that
|
||||
# cannot be the installer (a sign-in portal's page) before it is hashed.
|
||||
MAX_INSTALLER_BYTES=8388608
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
{
|
||||
"dest": "roms/ports/retrobios/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1471921,
|
||||
"sha256": "1c6286c90deb064affd0506cfa7b0c0c4ff19ad1555518f256ac98af86e188e2",
|
||||
"size": 1472446,
|
||||
"sha256": "1e45d5dd7b8904b85e9ce9cf30235e818e894b78099569476f0798b8ed4b90d0",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
@@ -71,8 +71,8 @@
|
||||
"muos": {
|
||||
"archive": {
|
||||
"dest": "ARCHIVE/RetroBIOS.muxapp",
|
||||
"size": 1525546,
|
||||
"sha256": "e1ae1df236e8dac0607ab7ee20c8ece56536b03fae23b9a25a05f65ae5de0f31"
|
||||
"size": 1526071,
|
||||
"sha256": "c1edcd8b80fc5c49064937cf0214ff336160fa082c4d0e6df961f0a1c84c16d6"
|
||||
},
|
||||
"members": [
|
||||
{
|
||||
@@ -92,8 +92,8 @@
|
||||
{
|
||||
"name": "RetroBIOS/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1471921,
|
||||
"sha256": "1c6286c90deb064affd0506cfa7b0c0c4ff19ad1555518f256ac98af86e188e2",
|
||||
"size": 1472446,
|
||||
"sha256": "1e45d5dd7b8904b85e9ce9cf30235e818e894b78099569476f0798b8ed4b90d0",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
@@ -166,8 +166,8 @@
|
||||
{
|
||||
"dest": ".config/modules/retrobios/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1471921,
|
||||
"sha256": "1c6286c90deb064affd0506cfa7b0c0c4ff19ad1555518f256ac98af86e188e2",
|
||||
"size": 1472446,
|
||||
"sha256": "1e45d5dd7b8904b85e9ce9cf30235e818e894b78099569476f0798b8ed4b90d0",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ from installer.detect_os import (
|
||||
_unix_retroarch_base,
|
||||
)
|
||||
from installer.host_fs import _SETUP_SEARCH, _exists, _host_path, _is_dir, _is_file, _note_refused
|
||||
from installer.paths import _record_moved_folders, shown_path
|
||||
from installer.paths import MOVED, RETRODECK_CONFIG, shown_path
|
||||
from installer.platforms import display_name
|
||||
from installer.text import _CONTROLS
|
||||
|
||||
@@ -683,9 +683,7 @@ def _detect_emudeck_unix(found: list[tuple[str, Path]]) -> None:
|
||||
|
||||
def _detect_retrodeck(home: Path, found: list[tuple[str, Path]]) -> None:
|
||||
"""Add RetroDECK's home folder."""
|
||||
# RetroDECK: retrodeck.json since the cfg-to-json migration, which
|
||||
# renames the old retrodeck.cfg to retrodeck.bak (global.sh:149-153)
|
||||
retrodeck_conf_dir = home / ".var" / "app" / "net.retrodeck.retrodeck" / "config" / "retrodeck"
|
||||
retrodeck_conf_dir = home / RETRODECK_CONFIG
|
||||
retrodeck_json = retrodeck_conf_dir / "retrodeck.json"
|
||||
retrodeck_cfg = retrodeck_conf_dir / "retrodeck.cfg"
|
||||
if _exists(retrodeck_json):
|
||||
@@ -698,7 +696,7 @@ def _detect_retrodeck(home: Path, found: list[tuple[str, Path]]) -> None:
|
||||
f"{retrodeck_json}: assuming {home / 'retrodeck'}",
|
||||
)
|
||||
rd_root = Path(rd_home) if rd_home else home / "retrodeck"
|
||||
_record_moved_folders(rd_root, retrodeck_json)
|
||||
MOVED.record(rd_root, retrodeck_json)
|
||||
found.append(("retrodeck", rd_root))
|
||||
elif _exists(retrodeck_cfg):
|
||||
rd_home = _parse_bash_var(retrodeck_cfg, "rdhome")
|
||||
|
||||
@@ -25,7 +25,7 @@ from installer.host_fs import (
|
||||
_is_file,
|
||||
refused_words,
|
||||
)
|
||||
from installer.paths import _MOVED_FOLDERS, shown_path
|
||||
from installer.paths import MOVED, shown_path
|
||||
from installer.platforms import display_name
|
||||
from installer.text import screen_text
|
||||
|
||||
@@ -363,7 +363,7 @@ def found_label(plat: str, path: Path) -> str:
|
||||
name = detected_shown(plat, path)
|
||||
shown = display_name(plat)
|
||||
moved = "".join(f", {folder}/ at {place}"
|
||||
for folder, place in sorted(_MOVED_FOLDERS.get(path, {}).items())
|
||||
for folder, place in sorted(MOVED.of(path).items())
|
||||
if folder in ("bios", "roms"))
|
||||
folder = shown_path(setup_bios_folder(plat, path))
|
||||
if not name or name == shown:
|
||||
|
||||
+68
-14
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import threading
|
||||
from pathlib import Path, PurePosixPath, PureWindowsPath
|
||||
from typing import NamedTuple
|
||||
|
||||
@@ -143,22 +144,23 @@ def _safe_target_dir(value: object, field: str) -> str:
|
||||
return value
|
||||
|
||||
|
||||
# A platform whose folders move one by one: root -> {folder under the root:
|
||||
# where it is now}. RetroDECK's per-folder move (RetroDECK 7786a849,
|
||||
# functions/api_data_processing.sh:913-935) records each new place in
|
||||
# retrodeck.json paths.<folder>_path (config/retrodeck/retrodeck.json:3-23),
|
||||
# and its manifest places files under bios/ and roms/ of the home folder.
|
||||
_MOVED_FOLDERS: dict[Path, dict[str, Path]] = {}
|
||||
# RetroDECK's settings folder below the home folder: retrodeck.json since the
|
||||
# cfg-to-json migration, which renames the old retrodeck.cfg to retrodeck.bak
|
||||
# (global.sh:149-153).
|
||||
RETRODECK_CONFIG = Path(".var") / "app" / "net.retrodeck.retrodeck" / "config" / "retrodeck"
|
||||
|
||||
|
||||
def _record_moved_folders(root: Path, retrodeck_json: Path) -> None:
|
||||
"""Each RetroDECK folder that is no longer <home>/<name>."""
|
||||
def _retrodeck_paths(retrodeck_json: Path) -> dict | None:
|
||||
"""The paths table of retrodeck.json, None when it cannot be read."""
|
||||
try:
|
||||
paths = json.loads(retrodeck_json.read_text(encoding="utf-8", errors="replace"))["paths"]
|
||||
except (OSError, ValueError, KeyError, TypeError):
|
||||
return
|
||||
if not isinstance(paths, dict):
|
||||
return
|
||||
return None
|
||||
return paths if isinstance(paths, dict) else None
|
||||
|
||||
|
||||
def _moved_in(root: Path, paths: dict) -> dict[str, Path]:
|
||||
"""Each RetroDECK folder that is no longer <home>/<name>."""
|
||||
moved = {}
|
||||
for key, value in paths.items():
|
||||
name = key[:-len("_path")] if key.endswith("_path") else ""
|
||||
@@ -166,8 +168,60 @@ def _record_moved_folders(root: Path, retrodeck_json: Path) -> None:
|
||||
place = Path(value.strip())
|
||||
if place != root / name:
|
||||
moved[name] = place
|
||||
if moved:
|
||||
_MOVED_FOLDERS[root] = moved
|
||||
return moved
|
||||
|
||||
|
||||
class MovedFolders:
|
||||
"""A platform whose folders move one by one: root -> {folder under the
|
||||
root: where it is now}.
|
||||
|
||||
RetroDECK's per-folder move (RetroDECK 7786a849,
|
||||
functions/api_data_processing.sh:913-935) records each new place in
|
||||
retrodeck.json paths.<folder>_path (config/retrodeck/retrodeck.json:3-23),
|
||||
and its manifest places files under bios/ and roms/ of the home folder.
|
||||
A root is looked up on first use, so a run given --dest that never
|
||||
detects places files where a detecting run does; detection only fills
|
||||
the cache ahead.
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._lock = threading.Lock()
|
||||
self._by_root: dict[Path, dict[str, Path]] = {}
|
||||
|
||||
def reset(self) -> None:
|
||||
with self._lock:
|
||||
self._by_root.clear()
|
||||
|
||||
def record(self, root: Path, retrodeck_json: Path) -> None:
|
||||
"""root's moved folders, as retrodeck_json lists them."""
|
||||
paths = _retrodeck_paths(retrodeck_json)
|
||||
with self._lock:
|
||||
self._by_root[root] = _moved_in(root, paths) if paths is not None else {}
|
||||
|
||||
def of(self, root: Path) -> dict[str, Path]:
|
||||
"""root's moved folders: none unless root is RetroDECK's home folder."""
|
||||
with self._lock:
|
||||
known = self._by_root.get(root)
|
||||
if known is not None:
|
||||
return known
|
||||
moved = self._look_up(root)
|
||||
with self._lock:
|
||||
return self._by_root.setdefault(root, moved)
|
||||
|
||||
@staticmethod
|
||||
def _look_up(root: Path) -> dict[str, Path]:
|
||||
home = Path.home()
|
||||
paths = _retrodeck_paths(home / RETRODECK_CONFIG / "retrodeck.json")
|
||||
if paths is None:
|
||||
return {}
|
||||
rd_home = paths.get("rd_home_path")
|
||||
rd_root = Path(rd_home) if isinstance(rd_home, str) and rd_home else home / "retrodeck"
|
||||
if os.path.abspath(rd_root) != os.path.abspath(root):
|
||||
return {}
|
||||
return _moved_in(root, paths)
|
||||
|
||||
|
||||
MOVED = MovedFolders()
|
||||
|
||||
|
||||
# Resolved folder -> the same folder as the run names it: /sdcard is a link
|
||||
@@ -212,7 +266,7 @@ def _destination_path(root: Path, value: object) -> Path:
|
||||
emulator reads it.
|
||||
"""
|
||||
relative = _safe_relative_path(value, "dest")
|
||||
moved = _MOVED_FOLDERS.get(root, {})
|
||||
moved = MOVED.of(root)
|
||||
if len(relative.parts) > 1 and relative.parts[0] in moved:
|
||||
return moved[relative.parts[0]].resolve() / Path(*relative.parts[1:])
|
||||
return _note_spelling(root) / Path(*relative.parts)
|
||||
|
||||
@@ -30,6 +30,7 @@ from installer.lists import ListFailure, load_targets
|
||||
from installer.offline import LOCAL
|
||||
from installer.pack import pack_path
|
||||
from installer.pack_source import pack_name_platforms
|
||||
from installer.paths import MOVED
|
||||
from installer.platforms import AVAILABLE_PLATFORMS, _NO_BIOS_FOLDER, display_name, normalize_platform
|
||||
from installer.refusal import Refusal
|
||||
from installer.run_files import _output_kind, needed_targets
|
||||
@@ -109,6 +110,7 @@ class _InstallRun:
|
||||
def _start_install(args: argparse.Namespace, real_stdout: TextIO) -> _InstallRun:
|
||||
"""The run's options completed, its terminal and its local sources opened."""
|
||||
KEPT.reset()
|
||||
MOVED.reset()
|
||||
# A namespace built by a caller that predates --for-games has neither.
|
||||
args.for_games = getattr(args, "for_games", None)
|
||||
args.required_only = getattr(args, "required_only", False)
|
||||
|
||||
@@ -29,7 +29,7 @@ from installer.host_fs import (
|
||||
)
|
||||
from installer.invocation import _INVOCATION
|
||||
from installer.local_check import _digest_file, expected_hashes
|
||||
from installer.paths import _MOVED_FOLDERS, _entry_path, _entry_place, _note_spelling, _safe_relative_path, spelled
|
||||
from installer.paths import MOVED, _entry_path, _entry_place, _note_spelling, _safe_relative_path, spelled
|
||||
from installer.text import _plural, format_size
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -262,7 +262,7 @@ def _kept_slot(root: Path, value: object) -> tuple[Path, PurePosixPath]:
|
||||
it, as _destination_path places it: a RetroDECK folder moved elsewhere
|
||||
is its own folder."""
|
||||
relative = _safe_relative_path(value, "dest")
|
||||
moved = _MOVED_FOLDERS.get(root, {})
|
||||
moved = MOVED.of(root)
|
||||
if len(relative.parts) > 1 and relative.parts[0] in moved:
|
||||
return moved[relative.parts[0]].resolve(), PurePosixPath(*relative.parts[1:])
|
||||
return _note_spelling(root), relative
|
||||
|
||||
+18
-1
@@ -3549,7 +3549,7 @@ class RetroDeckFoldersMovedOneByOne(unittest.TestCase):
|
||||
(conf / "retrodeck.json").write_text(json.dumps({"paths": paths}))
|
||||
with unittest.mock.patch.object(install.Path, "home", return_value=home), \
|
||||
unittest.mock.patch.object(install, "_detect_embedded", return_value=[]), \
|
||||
unittest.mock.patch.dict(install._MOVED_FOLDERS, clear=True), \
|
||||
unittest.mock.patch.object(install.MOVED, "_by_root", {}), \
|
||||
contextlib.redirect_stderr(io.StringIO()):
|
||||
found = install.detect_platforms("linux")
|
||||
dests = {name: install._destination_path(home / "retrodeck", f"{name}/a.bin")
|
||||
@@ -3579,6 +3579,23 @@ class RetroDeckFoldersMovedOneByOne(unittest.TestCase):
|
||||
self.assertIn(("retrodeck", rd_home), found)
|
||||
self.assertNotIn("bios/ at", label)
|
||||
|
||||
def test_a_run_that_never_detects_follows_the_move(self):
|
||||
"""--platform retrodeck --dest D never detects, and the full-screen
|
||||
interface passes --dest to every child run: the files went to
|
||||
<home>/bios before a detection had filled the moved folders."""
|
||||
home = scratch_dir(self)
|
||||
sd = home / "sd"
|
||||
conf = home / ".var/app/net.retrodeck.retrodeck/config/retrodeck"
|
||||
conf.mkdir(parents=True)
|
||||
(conf / "retrodeck.json").write_text(json.dumps({"paths": {
|
||||
"rd_home_path": "", "bios_path": str(sd / "bios")}}))
|
||||
with unittest.mock.patch.object(install.Path, "home", return_value=home), \
|
||||
unittest.mock.patch.object(install.MOVED, "_by_root", {}):
|
||||
dest = install._destination_path(home / "retrodeck", "bios/a.bin")
|
||||
other = install._destination_path(home / "elsewhere", "bios/a.bin")
|
||||
self.assertEqual(dest, (sd / "bios").resolve() / "a.bin")
|
||||
self.assertEqual(other, (home / "elsewhere").resolve() / "bios" / "a.bin")
|
||||
|
||||
|
||||
class AndroidCitationsNameTheRelease(unittest.TestCase):
|
||||
"""The Android detection cited platform_unix.c lines of a RetroArch
|
||||
|
||||
Reference in new issue
Block a user