fix: let A go deeper from home or a drive root

With no usual folder the browser opened at HOME on Use this folder, and A pressed through the screens installed the BIOS files into ~. At HOME or a drive's root A now opens the first folder. Picking the old card to copy from is unchanged.
This commit is contained in:
Abdessamad Derraz committed 2026-10-24 01:38:31 +02:00
1 parent 086ec46165
commit fd33ad0d96
4 files changed
+28 -2

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 = "04070f071adf988291854cf4ad8fb6e7a34f8044cfbcb710ba660863c2c6b19e"
$defaultInstallSha256 = "23f334efb9e37ba1c2542b8599db7af6e67dfd5e0061d39cb507765f2594bd45"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+6
View File
@@ -10924,6 +10924,12 @@ def _browse_to(state: TuiState, folder: Path | None, came_from: Path | None = No
state.browse_dir = folder
state.browse_rows, state.status = _browse_rows(folder, state.browse_for == "from")
focus = 0
if (folder is not None and state.browse_for != "from"
and folder in (state.home, Path(folder.anchor))):
# No frontend reads its BIOS files from HOME or a drive's root: A
# pressed through the screens installed into ~. A goes deeper there.
focus = next((index for index, row in enumerate(state.browse_rows)
if row.action == "dir" and row.value != folder.parent), 0)
for index, row in enumerate(state.browse_rows):
if came_from is not None and row.action == "dir" and row.value == came_from:
focus = index
+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="04070f071adf988291854cf4ad8fb6e7a34f8044cfbcb710ba660863c2c6b19e"
DEFAULT_INSTALL_SHA256="23f334efb9e37ba1c2542b8599db7af6e67dfd5e0061d39cb507765f2594bd45"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+20
View File
@@ -642,6 +642,26 @@ class Flow(unittest.TestCase):
self.assertEqual(effects, [("fetch", "retroarch")])
self.assertEqual(state.dest, root)
def test_a_holds_no_bios_folder_root_never_takes_a(self):
"""With no usual folder the browser opens at HOME, on Use this
folder: A five times installed the BIOS files into ~. At HOME or a
drive's root, A goes into the first folder instead."""
home = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
self.addCleanup(shutil.rmtree, home, True)
(home / "Games").mkdir()
state = install.TuiState(os_type="linux", home=home)
state.platform = "retroarch"
state.stack = ["folder"]
state.folder_default = None
with mock.patch.object(install, "_mounted_cards", return_value=[]):
install._browse_to(state, home)
self.assertEqual(state.browse_rows[state.focus["browse"]].label, "Games/")
install._browse_to(state, home / "Games")
self.assertEqual(state.browse_rows[state.focus["browse"]].label,
"Use this folder")
install._browse_to(state, Path(home.anchor))
self.assertNotEqual(state.browse_rows[state.focus["browse"]].action, "use")
def test_cards_are_listed_first(self):
card = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
self.addCleanup(shutil.rmtree, card, True)