From d152cd75d8058341eca61f6940d6c7ccf4a5607c Mon Sep 17 00:00:00 2001 From: Kiril Bourakov <86131959+KirilBourakov@users.noreply.github.com> Date: Fri, 29 Nov 2024 13:34:28 -0400 Subject: [PATCH] fix: "open in explorer" opens correct folder (#603) * replaced as_posix with str * replaced addition with f string --------- Co-authored-by: Travis Abendshien <46939827+CyanVoxel@users.noreply.github.com> --- tagstudio/src/qt/helpers/file_opener.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tagstudio/src/qt/helpers/file_opener.py b/tagstudio/src/qt/helpers/file_opener.py index 0672ed84..d402e1de 100644 --- a/tagstudio/src/qt/helpers/file_opener.py +++ b/tagstudio/src/qt/helpers/file_opener.py @@ -31,10 +31,11 @@ def open_file(path: str | Path, file_manager: bool = False): try: if sys.platform == "win32": - normpath = Path(path).resolve().as_posix() + normpath = str(Path(path).resolve()) if file_manager: command_name = "explorer" - command_arg = '/select,"' + normpath + '"' + command_arg = f'/select,"{normpath}"' + # For some reason, if the args are passed in a list, this will error when the # path has spaces, even while surrounded in double quotes. subprocess.Popen(