From b23b8f0a62a58bb58d49323364d6feb8239618b5 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:12:38 +0100 Subject: [PATCH] fix: find RetroArch-Win64 from WSL too --- install.ps1 | 2 +- install.py | 8 ++++---- install.sh | 2 +- tests/test_install.py | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/install.ps1 b/install.ps1 index db72b7c21..729b6d2e4 100644 --- a/install.ps1 +++ b/install.ps1 @@ -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 = "403b6e8a7efcd24858b0f46ffa19c2b9012cdeef149768729d8e48d0b68a296a" + $defaultInstallSha256 = "87d93c52753fedb9739816c628ba9109f92f6c5cc0aa6e1c5c3c3d2252244666" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index c9894999b..eb8adfc7a 100644 --- a/install.py +++ b/install.py @@ -55,9 +55,9 @@ from collections.abc import Callable, Collection, Iterable, Iterator, Mapping from pathlib import Path, PurePosixPath from typing import Any, BinaryIO, ContextManager, NamedTuple, TextIO -# Manifests are read from the same ref the bootstrap verified this installer -# against, so a file list and the code reading it always come from one commit. -# RETROBIOS_REF pins an installation to a tag when reproducibility matters. +# File lists are read from main, the newest ones, whichever commit the +# installer came from. RETROBIOS_REF pins them to a tag or a commit when +# reproducibility matters. DEFAULT_RELEASE_REF = "main" RELEASE_REF = os.environ.get("RETROBIOS_REF", DEFAULT_RELEASE_REF) DEFAULT_BASE_URL = ( @@ -2647,7 +2647,7 @@ def detect_platforms(os_type: str) -> list[tuple[str, Path]]: # default is \system (configuration.c, platform_win32.c). appdata = os.environ.get("APPDATA", "") appdata_cfg = Path(appdata) / "RetroArch" / "retroarch.cfg" if appdata else None - exe_dirs = _windows_retroarch_dirs() if os_type == "windows" else [] + exe_dirs = _windows_retroarch_dirs() for exe_dir in exe_dirs: ra_dir = _parse_retroarch_system_dir(exe_dir / "retroarch.cfg", exe_dir) if ra_dir is None and appdata_cfg is not None: diff --git a/install.sh b/install.sh index cacf12717..3e264dab6 100755 --- a/install.sh +++ b/install.sh @@ -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="403b6e8a7efcd24858b0f46ffa19c2b9012cdeef149768729d8e48d0b68a296a" +DEFAULT_INSTALL_SHA256="87d93c52753fedb9739816c628ba9109f92f6c5cc0aa6e1c5c3c3d2252244666" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/tests/test_install.py b/tests/test_install.py index 60d2fe8fe..6c5ffc1e7 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -3658,6 +3658,21 @@ class WindowsSeenFromWsl(unittest.TestCase): install._detect_by_path("wsl", found) self.assertIn(("retrobat", self.root / "c" / "RetroBat" / "bios"), found) + def test_retroarch_beside_its_exe_on_the_windows_side_is_detected(self): + """The installer page said both sides are searched under WSL, and + RetroArch's install folders were looked in on Windows only: a + C:\\RetroArch-Win64 was never found from WSL.""" + exe_dir = self.root / "c" / "RetroArch-Win64" + exe_dir.mkdir(parents=True) + (exe_dir / "retroarch.exe").write_bytes(b"MZ") + home = Path(_tempdir(self)) + cleared = {name: "" for name in (*install._WINDOWS_VARIABLES, "SCOOP", "SCOOP_GLOBAL", + "ProgramData")} + with unittest.mock.patch.dict(os.environ, {**cleared, "HOME": str(home)}), \ + unittest.mock.patch.object(Path, "home", return_value=home): + found = install.detect_platforms("wsl") + self.assertIn(("retroarch", exe_dir / "system"), found) + def test_the_windows_variables_are_read_through_cmd(self): answers = {"USERPROFILE": "C:\\Users\\me", "APPDATA": "C:\\Users\\me\\AppData\\Roaming"}