fix: say when the RetroDECK home is a guess

This commit is contained in:
Abdessamad Derraz committed 2026-10-18 14:58:07 +02:00
1 parent 213d19ed27
commit a60951c0ca
4 files changed
+31 -2

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ param(
$ErrorActionPreference = "Stop"
$defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
$defaultInstallSha256 = "236441baeb94f442c15a93ac01a203ce63f2938553b491db13dfb19074bbef46"
$defaultInstallSha256 = "c997339fd3efb879983937ed9dea6d0190d4689dedf627906c622f329587b757"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+8
View File
@@ -952,6 +952,14 @@ def detect_platforms(os_type: str) -> list[tuple[str, Path]]:
retrodeck_cfg = retrodeck_conf_dir / "retrodeck.cfg"
if retrodeck_json.exists():
rd_home = _parse_json_path(retrodeck_json, "paths", "rd_home_path")
if not rd_home:
# A home moved to an SD card lives only in this file: the
# default is a guess, and the user is told so.
print(
f"Warning: could not read paths.rd_home_path from "
f"{retrodeck_json}; assuming {home / 'retrodeck'}",
file=sys.stderr,
)
found.append(("retrodeck", Path(rd_home) if rd_home else home / "retrodeck"))
elif retrodeck_cfg.exists():
rd_home = _parse_bash_var(retrodeck_cfg, "rdhome")
+1 -1
View File
@@ -18,7 +18,7 @@ esac
TEMP_INSTALLER=""
TEMP_DIRECTORY=""
DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
DEFAULT_INSTALL_SHA256="236441baeb94f442c15a93ac01a203ce63f2938553b491db13dfb19074bbef46"
DEFAULT_INSTALL_SHA256="c997339fd3efb879983937ed9dea6d0190d4689dedf627906c622f329587b757"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+21
View File
@@ -2260,5 +2260,26 @@ class CaseVariants(unittest.TestCase):
)
class AnUnreadableRetroDeckConfigIsSaid(unittest.TestCase):
"""retrodeck.json present but unreadable: the installer wrote to
~/retrodeck without a word, where a home moved to an SD card is not."""
def test_the_fallback_is_announced(self):
import contextlib
home = Path(_tempdir(self))
conf = home / ".var" / "app" / "net.retrodeck.retrodeck" / "config" / "retrodeck"
conf.mkdir(parents=True)
(conf / "retrodeck.json").write_text("{truncated")
err = io.StringIO()
with unittest.mock.patch.object(install.Path, "home", return_value=home), \
unittest.mock.patch.object(install, "_detect_embedded", return_value=[]), \
contextlib.redirect_stderr(err):
found = install.detect_platforms("linux")
self.assertIn(("retrodeck", home / "retrodeck"), found)
self.assertIn("could not read paths.rd_home_path", err.getvalue())
if __name__ == "__main__":
unittest.main()