fix: read a RetroDECK bios dest as its folder

This commit is contained in:
Abdessamad Derraz committed 2026-11-05 11:56:00 +01:00
1 parent 896dbc8660
commit 7da6e117a3
5 files changed
+37 -10

No files matched your search

+1 -1
View File
@@ -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 = "97857d0ba16eaa8be16a4c8832bf04b6ee6da1bcdbc0d747d1934cc3eb5ff909"
$defaultInstallSha256 = "9c9a29d182e9c4074197a4177e13c026e06c98defe0fc79ba820f1c696216213"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+6
View File
@@ -14074,6 +14074,12 @@ def _list_card_choice(plat: str, dest: Path) -> CardChoice:
return CardChoice(plat, dest, f"{screen_text(str(dest))} holds the files of "
f"{names}: installing into it as named. Name the card's BIOS "
"folder with --dest to write there.")
if plat == "retrodeck" and dest.name.lower() == "bios" and not _is_dir(dest / "bios"):
# RetroDECK's list writes bios/, roms/ and the rest below its own
# folder: its BIOS folder, which --help asks for, got bios/bios.
return CardChoice(plat, dest.parent, f"{shown_path(dest)} is RetroDECK's BIOS "
f"folder: the files go below {shown_path(dest.parent)}, the "
"RetroDECK folder holding it")
return CardChoice(plat, dest)
+1 -1
View File
@@ -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="97857d0ba16eaa8be16a4c8832bf04b6ee6da1bcdbc0d747d1934cc3eb5ff909"
DEFAULT_INSTALL_SHA256="9c9a29d182e9c4074197a4177e13c026e06c98defe0fc79ba820f1c696216213"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+8 -8
View File
@@ -27,8 +27,8 @@
{
"dest": "roms/ports/retrobios/install.py",
"repo_path": "install.py",
"size": 1081112,
"sha256": "97857d0ba16eaa8be16a4c8832bf04b6ee6da1bcdbc0d747d1934cc3eb5ff909",
"size": 1081583,
"sha256": "9c9a29d182e9c4074197a4177e13c026e06c98defe0fc79ba820f1c696216213",
"executable": false
},
{
@@ -71,8 +71,8 @@
"muos": {
"archive": {
"dest": "ARCHIVE/RetroBIOS.muxapp",
"size": 1134739,
"sha256": "c0bdf23698273f62236ff5928d035086625532995322b453107cc1b81c365972"
"size": 1135210,
"sha256": "59914e1d36e1169d6a9b24314a8e64833a434fa8c6df05916257aa5007855b0f"
},
"members": [
{
@@ -92,8 +92,8 @@
{
"name": "RetroBIOS/install.py",
"repo_path": "install.py",
"size": 1081112,
"sha256": "97857d0ba16eaa8be16a4c8832bf04b6ee6da1bcdbc0d747d1934cc3eb5ff909",
"size": 1081583,
"sha256": "9c9a29d182e9c4074197a4177e13c026e06c98defe0fc79ba820f1c696216213",
"executable": false
},
{
@@ -166,8 +166,8 @@
{
"dest": ".config/modules/retrobios/install.py",
"repo_path": "install.py",
"size": 1081112,
"sha256": "97857d0ba16eaa8be16a4c8832bf04b6ee6da1bcdbc0d747d1934cc3eb5ff909",
"size": 1081583,
"sha256": "9c9a29d182e9c4074197a4177e13c026e06c98defe0fc79ba820f1c696216213",
"executable": false
},
{
+21
View File
@@ -823,6 +823,27 @@ class APartlyClosedHome(unittest.TestCase):
self.assertEqual([entry["bios_dir"] for entry in detect["platforms"]], [str(system)])
class RetroDeckBiosFolderNamedAsDest(unittest.TestCase):
"""`--platform retrodeck --dest ~/retrodeck/bios`, as --help asks for a
BIOS folder, put every file under bios/bios, which RetroDECK never reads."""
def test_the_files_go_below_the_retrodeck_folder(self):
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
self.addCleanup(shutil.rmtree, root, True)
(root / "bios").mkdir()
choice = install.card_choice("retrodeck", "retrodeck", root / "bios")
self.assertEqual(choice.folder, root)
self.assertIn("RetroDECK's BIOS folder", choice.note)
self.assertFalse(choice.refused)
def test_the_retrodeck_folder_itself_is_kept(self):
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
self.addCleanup(shutil.rmtree, root, True)
(root / "bios").mkdir()
choice = install.card_choice("retrodeck", "retrodeck", root)
self.assertEqual((choice.folder, choice.note), (root, ""))
class AnUnreadableRetroArchConfigIsSaid(unittest.TestCase):
"""A retroarch.cfg a `sudo retroarch` left at 0600 for root was read as
no config at all: RetroArch was not found and nothing said why."""