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>
This commit is contained in:
Kiril Bourakov
2024-11-29 13:34:28 -04:00
committed by GitHub
parent 20f93719d7
commit d152cd75d8

View File

@@ -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(