diff --git a/install.ps1 b/install.ps1 index 02c9d9e52..a0e831f3a 100644 --- a/install.ps1 +++ b/install.ps1 @@ -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 = "24615e6f97626cda0547af94f94334e5964b99ce065c2d4fd3455c8782276812" + $defaultInstallSha256 = "eed68111561f629fcdd392da968628eb9f7a543a8b4d2f82bdd6931ebc9d532d" # The pin above refuses any changed byte: this cap only stops a body that # cannot be the installer (a sign-in portal's page) before it is hashed. $maximumInstallerBytes = 8MB diff --git a/install.py b/install.py index e848e20a6..c209c5674 100644 --- a/install.py +++ b/install.py @@ -2080,13 +2080,12 @@ def _typed_folder(raw: str) -> Path: Explorer's "Copy as path" puts quotes around it, and users quote a path with spaces: kept, they sent the files into a folder named `"` under - the current directory, and the run said Done. + the current directory, and the run said Done. A half-selected copy + quotes one end only. """ - text = raw.strip() - if len(text) >= 2 and text[0] == text[-1] and text[0] in "'\"": - text = text[1:-1].strip() + text = raw.strip().strip("\"'").strip() # Under WSL, D: and D:\ are the Windows drive the screen calls D:. - return _host_path(os.path.expandvars(os.path.expanduser(text))) + return _host_path(os.path.expanduser(os.path.expandvars(text))) def _ask(prompt: str) -> str: @@ -28906,11 +28905,9 @@ def _open_folder_screen(state: TuiState, default: Path | None, def typed_path(text: str) -> Path | None: """A folder typed or pasted: quotes off, ~ and variables expanded.""" - # Explorer's "Copy as path" quotes both ends, a half-selected copy one. - text = text.strip().strip("\"'").strip() - if not text: + if not text.strip().strip("\"'").strip(): return None - return _host_path(os.path.expanduser(os.path.expandvars(text))) + return _typed_folder(text) def _tui_folder_facts(state: TuiState) -> dict: diff --git a/install.sh b/install.sh index 37aa16b77..07fed56e0 100755 --- a/install.sh +++ b/install.sh @@ -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="24615e6f97626cda0547af94f94334e5964b99ce065c2d4fd3455c8782276812" +DEFAULT_INSTALL_SHA256="eed68111561f629fcdd392da968628eb9f7a543a8b4d2f82bdd6931ebc9d532d" # The pin above refuses any changed byte: this cap only stops a body that # cannot be the installer (a sign-in portal's page) before it is hashed. MAX_INSTALLER_BYTES=8388608 diff --git a/install/launchers/index.json b/install/launchers/index.json index 8125f7530..13a74c5a7 100644 --- a/install/launchers/index.json +++ b/install/launchers/index.json @@ -27,8 +27,8 @@ { "dest": "roms/ports/retrobios/install.py", "repo_path": "install.py", - "size": 1449658, - "sha256": "24615e6f97626cda0547af94f94334e5964b99ce065c2d4fd3455c8782276812", + "size": 1449494, + "sha256": "eed68111561f629fcdd392da968628eb9f7a543a8b4d2f82bdd6931ebc9d532d", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 1503283, - "sha256": "5e53ba1ca6d7fe47789b84fe1aaaba50e3752454ffc182389bd83e1f905baca1" + "size": 1503119, + "sha256": "83cbb67cf4c2f9244e2112f6326fdf6874dfd48998cb017f56979670f3d34b6a" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 1449658, - "sha256": "24615e6f97626cda0547af94f94334e5964b99ce065c2d4fd3455c8782276812", + "size": 1449494, + "sha256": "eed68111561f629fcdd392da968628eb9f7a543a8b4d2f82bdd6931ebc9d532d", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 1449658, - "sha256": "24615e6f97626cda0547af94f94334e5964b99ce065c2d4fd3455c8782276812", + "size": 1449494, + "sha256": "eed68111561f629fcdd392da968628eb9f7a543a8b4d2f82bdd6931ebc9d532d", "executable": false }, { diff --git a/installer/console.py b/installer/console.py index 0af8d2e61..a97b37b35 100644 --- a/installer/console.py +++ b/installer/console.py @@ -19,13 +19,12 @@ def _typed_folder(raw: str) -> Path: Explorer's "Copy as path" puts quotes around it, and users quote a path with spaces: kept, they sent the files into a folder named `"` under - the current directory, and the run said Done. + the current directory, and the run said Done. A half-selected copy + quotes one end only. """ - text = raw.strip() - if len(text) >= 2 and text[0] == text[-1] and text[0] in "'\"": - text = text[1:-1].strip() + text = raw.strip().strip("\"'").strip() # Under WSL, D: and D:\ are the Windows drive the screen calls D:. - return _host_path(os.path.expandvars(os.path.expanduser(text))) + return _host_path(os.path.expanduser(os.path.expandvars(text))) def _ask(prompt: str) -> str: diff --git a/installer/tui_actions.py b/installer/tui_actions.py index 48f27f0f6..7b0106634 100644 --- a/installer/tui_actions.py +++ b/installer/tui_actions.py @@ -19,7 +19,7 @@ from installer.cards import ( card_system, ) from installer.choices import emulator_names -from installer.console import QUIT_CODE +from installer.console import QUIT_CODE, _typed_folder from installer.cores import CORE_PLATFORMS, core_dirs, installed_cores from installer.destination import ( _card_is, @@ -33,7 +33,7 @@ from installer.destination import ( from installer.detect_os import _DETECTED_OS, _FROM_CARD, detected_os, detected_shown from installer.embedded import CARD_PLATFORMS, _a from installer.games import games_probe -from installer.host_fs import _exists, _folder_writable, _host_path, _is_dir, _nearest_folder, closed_folder +from installer.host_fs import _exists, _folder_writable, _is_dir, _nearest_folder, closed_folder from installer.install_record import RECORD_NARROWING, _RECORD_SAID, record_options, setup_record from installer.invocation import OFFLINE_VARIABLE, offline_requested from installer.network import local_targets @@ -732,11 +732,9 @@ def _open_folder_screen(state: TuiState, default: Path | None, def typed_path(text: str) -> Path | None: """A folder typed or pasted: quotes off, ~ and variables expanded.""" - # Explorer's "Copy as path" quotes both ends, a half-selected copy one. - text = text.strip().strip("\"'").strip() - if not text: + if not text.strip().strip("\"'").strip(): return None - return _host_path(os.path.expanduser(os.path.expandvars(text))) + return _typed_folder(text) def _tui_folder_facts(state: TuiState) -> dict: diff --git a/tests/test_install.py b/tests/test_install.py index cbc689188..a9c5e075a 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -2218,7 +2218,9 @@ class TestManualPlatformPrompt(unittest.TestCase): folder named `"` under the current directory, and the run said Done.""" root = Path(_tempdir(self)) for typed in (f'"{root}/My Card/bios"', f"'{root}/My Card/bios'", - f' "{root}/My Card/bios" '): + f' "{root}/My Card/bios" ', + # A half-selected copy: line mode kept the quote. + f'"{root}/My Card/bios'): answers = iter(["1", typed]) with self.subTest(typed=typed), \ unittest.mock.patch("builtins.input",