fix: give the bare platform menu its default

With nothing detected, the menu had no Enter default, while --help and
the --dest menu name RetroArch as the fallback. Its title now also says
why the question is asked.
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 14:21:45 +02:00
1 parent 19b4ef5de4
commit 778d2d56e6
4 files changed
+14 -3

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@
$ErrorActionPreference = "Stop"
$defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
$defaultInstallSha256 = "d32af09905abef095c8e5e8fa832fbc76d1556e9cd099b81227d68d1d66d2915"
$defaultInstallSha256 = "8cfe5cb80b8df7f8c2736cfe5855a768c3eacad6ebf5bfd7336b3b4f5a4d5d76"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+2 -1
View File
@@ -5603,7 +5603,8 @@ def _choose_platform(title: str, default: str = "") -> str:
def _prompt_manual_platform(os_type: str) -> list[tuple[str, Path]]:
"""Ask for a platform and a BIOS directory when nothing was detected."""
plat = _choose_platform("Choose the platform to install for:")
plat = _choose_platform("No supported platform found here. Choose the one to "
"install for:", "retroarch")
default_dest = _default_dest(os_type, plat)
raw = ""
while not raw:
+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="d32af09905abef095c8e5e8fa832fbc76d1556e9cd099b81227d68d1d66d2915"
DEFAULT_INSTALL_SHA256="8cfe5cb80b8df7f8c2736cfe5855a768c3eacad6ebf5bfd7336b3b4f5a4d5d76"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+10
View File
@@ -1808,6 +1808,16 @@ class TestManualPlatformPrompt(unittest.TestCase):
chosen, [("retroarch", Path.home() / ".config" / "retroarch" / "system")]
)
def test_enter_takes_retroarch_as_the_dest_menu_does(self):
"""The --dest menu offered `[Enter for RetroArch]` and this one, the
same list, had no default."""
answers = iter(["", ""])
out = io.StringIO()
with unittest.mock.patch("builtins.input", lambda _prompt="": next(answers)), \
contextlib.redirect_stdout(out):
chosen = install._prompt_manual_platform("linux")
self.assertEqual(chosen[0][0], "retroarch")
def test_name_and_explicit_directory(self):
answers = iter(["batocera", "~/my bios"])
with unittest.mock.patch("builtins.input", lambda _prompt="": next(answers)):