diff --git a/install.ps1 b/install.ps1 index 58bbdef8..3f72df34 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 = "142edea98e646ed11e27052d3dd02125a27d4cdb7ee04392e6af8fcd28f9762f" +$defaultInstallSha256 = "bf522ef64ecbefc14202a879b6c943e44939dfda37eb416b1897070ad7cefa85" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index 0d54fde9..2f923d4d 100644 --- a/install.py +++ b/install.py @@ -567,11 +567,19 @@ def _windows_retroarch_dirs() -> list[Path]: def _macos_retroarch_base() -> Path: """Where RetroArch on macOS keeps its system folder by default: - ~/Documents/RetroArch, or Application Support/RetroArch when that folder - holds portable.txt (platform_darwin.m).""" + ~/Documents/RetroArch, or Application Support/RetroArch for a portable + install. The Steam build is always portable (platform_darwin.m, `#if + HAVE_STEAM portable = YES`), with no portable.txt to say so: its + bundle under Steam's library, and no other RetroArch.app, mark it.""" support = Path.home() / "Library" / "Application Support" / "RetroArch" if (support / "portable.txt").is_file(): return support + steam = ( + Path.home() / "Library" / "Application Support" / "Steam" / "steamapps" + / "common" / "RetroArch" / "RetroArch.app" + ) + if steam.is_dir() and not Path("/Applications/RetroArch.app").is_dir(): + return support return Path.home() / "Documents" / "RetroArch" diff --git a/install.sh b/install.sh index 2545286f..8958d351 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="142edea98e646ed11e27052d3dd02125a27d4cdb7ee04392e6af8fcd28f9762f" +DEFAULT_INSTALL_SHA256="bf522ef64ecbefc14202a879b6c943e44939dfda37eb416b1897070ad7cefa85" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/tests/test_install.py b/tests/test_install.py index e11887ef..baac8bbb 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -2826,5 +2826,20 @@ class WindowsSeenFromWsl(unittest.TestCase): self.assertEqual(os.environ["ProgramFiles"], "") +class SteamRetroArchOnMacIsPortable(unittest.TestCase): + """platform_darwin.m makes the Steam build portable (HAVE_STEAM) with no + portable.txt: a default system_directory is Application Support's, and + the installer took ~/Documents/RetroArch/system.""" + + def test_the_steam_bundle_moves_the_base(self): + home = Path(_tempdir(self)) + support = home / "Library" / "Application Support" + with unittest.mock.patch.dict(os.environ, {"HOME": str(home)}), \ + unittest.mock.patch.object(Path, "home", return_value=home): + self.assertEqual(install._macos_retroarch_base(), home / "Documents" / "RetroArch") + (support / "Steam/steamapps/common/RetroArch/RetroArch.app").mkdir(parents=True) + self.assertEqual(install._macos_retroarch_base(), support / "RetroArch") + + if __name__ == "__main__": unittest.main() diff --git a/wiki/installer.md b/wiki/installer.md index e7e14283..faa6298b 100644 --- a/wiki/installer.md +++ b/wiki/installer.md @@ -306,7 +306,7 @@ WSL does not pass them. A forced `--platform retrobat` falls back to | `~/.var/app/org.libretro.RetroArch/config/retroarch/retroarch.cfg` | RetroArch (Flatpak) | `system_directory` | | `~/snap/retroarch/current/.config/retroarch/retroarch.cfg` | RetroArch (Snap) | `system_directory` | | `~/.config/retroarch/retroarch.cfg` | RetroArch (native) | `system_directory` | -| `~/Library/Application Support/RetroArch/config/retroarch.cfg` | RetroArch (macOS) | `system_directory`; at default, `~/Documents/RetroArch/system` (portable: `Application Support/RetroArch/system`) | +| `~/Library/Application Support/RetroArch/config/retroarch.cfg` | RetroArch (macOS) | `system_directory`; at default, `~/Documents/RetroArch/system` (portable, Steam build included: `Application Support/RetroArch/system`) | | `retroarch.cfg` beside `retroarch.exe` (`C:\RetroArch-Win64`, `C:\RetroArch`, `Program Files\RetroArch`) | RetroArch (Windows) | `system_directory`; at default or without a config, `system` beside the exe | | `%APPDATA%\RetroArch\retroarch.cfg` | RetroArch (Windows) | `system_directory`, read when the exe folder has no config | | `%ProgramFiles(x86)%\Steam\steamapps\common\RetroArch\retroarch.cfg` | RetroArch (Steam) | `system_directory` |