feat: find a RetroArch installed with Scoop

scoop install retroarch puts retroarch.exe under ~\scoop\apps\retroarch\current, its system folder persisted through a junction. The Windows search covered the installers' folders, Program Files, Steam, ES-DE and the Store package only, so the run offered C:\RetroArch-Win64\system, a folder that RetroArch never opens. The user and global Scoop roots are searched now, %SCOOP% and %SCOOP_GLOBAL% included.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 03:22:56 +02:00
1 parent 33091dabaf
commit dbf0647974
4 files changed
+31 -4

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 = "84b6a006895a34929d99cfd890f028c2ae09e134385dfd10cc955288daaf4260"
$defaultInstallSha256 = "2db3ce4cf58905d34d45633e7d955ba106b343f8348c8bd81ece5731560d331c"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+18 -2
View File
@@ -550,8 +550,9 @@ def _windows_retroarch_dirs() -> list[Path]:
"""Folders holding retroarch.exe where its installers put it.
C:/RetroArch-Win64 by default, C:/RetroArch for 32-bit builds, the same
names under Program Files, every Steam library, and the Emulators folder
of an installed ES-DE (es_find_rules.xml lists all of them).
names under Program Files, every Steam library, the Emulators folder of
an installed ES-DE (es_find_rules.xml lists all of them), and a Scoop
install, user or global.
"""
candidates = [_host_path("C:/RetroArch-Win64"), _host_path("C:/RetroArch")]
for var in ("ProgramFiles", "ProgramFiles(x86)"):
@@ -565,6 +566,21 @@ def _windows_retroarch_dirs() -> list[Path]:
candidates += [
library / "steamapps" / "common" / "RetroArch" for library in _steam_libraries()
]
# Scoop's Extras bucket: <root>\apps\retroarch\current, the root being
# %SCOOP% or ~\scoop for a user install, %SCOOP_GLOBAL% or
# %ProgramData%\scoop for a global one. Its system folder is persisted
# through a junction, so the folder beside retroarch.exe is the real one.
scoop_roots = [
os.environ.get("SCOOP") or (
str(Path(os.environ["USERPROFILE"]) / "scoop") if os.environ.get("USERPROFILE") else ""
),
os.environ.get("SCOOP_GLOBAL") or (
str(Path(os.environ["ProgramData"]) / "scoop") if os.environ.get("ProgramData") else ""
),
]
candidates += [
Path(root) / "apps" / "retroarch" / "current" for root in scoop_roots if root
]
return [folder for folder in candidates if (folder / "retroarch.exe").is_file()]
+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="84b6a006895a34929d99cfd890f028c2ae09e134385dfd10cc955288daaf4260"
DEFAULT_INSTALL_SHA256="2db3ce4cf58905d34d45633e7d955ba106b343f8348c8bd81ece5731560d331c"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+11
View File
@@ -1133,6 +1133,17 @@ class RetroArchIsFoundWhereWindowsInstallsPutIt(unittest.TestCase):
found = self._exe(program_files / "RetroArch-Win64")
self.assertIn(found, install._windows_retroarch_dirs())
def test_a_scoop_install(self):
# `scoop install retroarch` puts it under ~/scoop/apps/retroarch/current,
# which none of the searched folders covered.
program_files = Path(_tempdir(self))
self._env(program_files)
home = Path(_tempdir(self))
found = self._exe(home / "scoop" / "apps" / "retroarch" / "current")
with unittest.mock.patch.dict(os.environ, {"USERPROFILE": str(home)}):
os.environ.pop("SCOOP", None)
self.assertIn(found, install._windows_retroarch_dirs())
def test_a_steam_library_on_another_drive(self):
program_files = Path(_tempdir(self))
library = Path(_tempdir(self))