fix: read a typed folder the same in both modes

Line mode dropped quotes only when both ends had one, so a half-selected
paste made a folder whose name starts with a quote. The screen's reader
is now the only one: any quote at either end goes, variables expand
before ~.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:04:39 +01:00
1 parent ee2e6e80ce
commit 8c74f3f0bc
7 files changed
+27 -31

No files matched your search

+4 -5
View File
@@ -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: