From a60951c0caab3bd63f9347c683b11696e352030d Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sun, 18 Oct 2026 14:58:07 +0200 Subject: [PATCH] fix: say when the RetroDECK home is a guess --- install.ps1 | 2 +- install.py | 8 ++++++++ install.sh | 2 +- tests/test_install.py | 21 +++++++++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/install.ps1 b/install.ps1 index a3f7ad4b..c2269dd4 100644 --- a/install.ps1 +++ b/install.ps1 @@ -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 } diff --git a/install.py b/install.py index 8eed9f68..5e2a906c 100644 --- a/install.py +++ b/install.py @@ -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") diff --git a/install.sh b/install.sh index 39c5d91c..52e0b607 100755 --- a/install.sh +++ b/install.sh @@ -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() { diff --git a/tests/test_install.py b/tests/test_install.py index 24bd3737..47815ca5 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -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()