diff --git a/install.ps1 b/install.ps1 index 6ac2deb2..013467a5 100644 --- a/install.ps1 +++ b/install.ps1 @@ -11,7 +11,7 @@ $ErrorActionPreference = "Stop" $defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" - $defaultInstallSha256 = "b50eda2089a5da5fe4cb18f86a214fe3d8c08f04649f4ba94167fd35ab5942ac" + $defaultInstallSha256 = "568d9399c5639db607cfc3944fa46a0dfa8d47741291d9346ed336cd2500eb00" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index e5ed739d..bc0b9076 100644 --- a/install.py +++ b/install.py @@ -6406,7 +6406,10 @@ def _found_elsewhere( for path in matching or same_name: rel = index.relative(path) contents = "" if path in matching else ", with other contents" - if rel.endswith("/" + dest) and path.name == name: + # A dest below the save directory is not below this folder: a copy + # here under the same tail is in the wrong place, not too deep. + below = entry.get("root") != "save" + if below and rel.endswith("/" + dest) and path.name == name: extra = rel[: -len(dest) - 1] top = index.root.name if extra.casefold() == top.casefold(): diff --git a/install.sh b/install.sh index 5c9f2546..999f63c0 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="b50eda2089a5da5fe4cb18f86a214fe3d8c08f04649f4ba94167fd35ab5942ac" +DEFAULT_INSTALL_SHA256="568d9399c5639db607cfc3944fa46a0dfa8d47741291d9346ed336cd2500eb00" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/tests/test_install_offline.py b/tests/test_install_offline.py index 4f69e3ce..ad555075 100644 --- a/tests/test_install_offline.py +++ b/tests/test_install_offline.py @@ -197,6 +197,20 @@ class CheckNamesWhyAFileIsRefused(Scratch): self.assertIn("a name no core opens: its contents are at PSX BIOS (USA).bin, " "rename it scph5501.bin", self.check()) + def test_a_save_directory_file_left_in_the_bios_folder_is_in_the_wrong_folder(self): + """A pack carries the save directory's files under saves/: extracted + into the BIOS folder they sit beside it, not too deep in it.""" + self.place("saves/azahar/keys.txt", b"keys") + saves = self.root / "saves" + saves.mkdir() + install._SAVE_DIRS[self.dest] = install.SavePlace(saves, False) + self.addCleanup(install._SAVE_DIRS.pop, self.dest, None) + entry = _entry("azahar/keys.txt", b"keys", ["nintendo-3ds"], root="save") + found = install.diagnose([entry], [], [entry], self.dest) + self.assertEqual(found.reasons[id(entry)], + "wrong folder: it is at saves/azahar/keys.txt") + self.assertEqual(found.deep, {}) + def test_each_flagged_file_says_where_its_cores_open_it(self): self.complete("scph5501.bin", "pcsx/extra.bin") out = self.check()