From 1f7a5d3cbb00ceb33aa7edcf87dee72c2c19ac1f Mon Sep 17 00:00:00 2001 From: Xarvex Date: Fri, 26 Apr 2024 14:46:13 -0500 Subject: [PATCH] Windows: fix files w/ spaces opening cmd rather than associated program --- tagstudio/src/qt/ts_qt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tagstudio/src/qt/ts_qt.py b/tagstudio/src/qt/ts_qt.py index 306fe857..bda97854 100644 --- a/tagstudio/src/qt/ts_qt.py +++ b/tagstudio/src/qt/ts_qt.py @@ -68,7 +68,8 @@ QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, os.getcwd()) def open_file(path: str): try: if sys.platform == "win32": - subprocess.Popen(["start", path], shell=True, close_fds=True, creationflags=subprocess.DETACHED_PROCESS) + # Windows needs special attention to handle spaces in the file + subprocess.Popen(["start", f'"{path.replace('"', '\"')}"'], shell=True, close_fds=True, creationflags=subprocess.DETACHED_PROCESS) else: if sys.platform == "darwin": command_name = "open"