Skip to content

Commit 8b4b250

Browse files
committed
Account for start being a shell builtin on Windows
1 parent f125e5a commit 8b4b250

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

tagstudio/src/qt/ts_qt.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,21 @@
5959

6060

6161
def open_file(path: str):
62-
if sys.platform == "win32":
63-
command_name = "start"
64-
elif sys.platform == "darwin":
65-
command_name = "open"
66-
else:
67-
command_name = "xdg-open"
68-
command = shutil.which(command_name)
69-
if command is not None:
70-
try:
71-
subprocess.Popen([command, path], close_fds=True)
72-
except:
73-
traceback.print_exc()
74-
else:
75-
logging.info(f"Could not find {command_name} on system PATH")
62+
try:
63+
if sys.platform == "win32":
64+
subprocess.Popen(["start", path], shell=True, close_fds=True)
65+
else:
66+
if sys.platform == "darwin":
67+
command_name = "open"
68+
else:
69+
command_name = "xdg-open"
70+
command = shutil.which(command_name)
71+
if command is not None:
72+
subprocess.Popen([command, path], close_fds=True)
73+
else:
74+
logging.info(f"Could not find {command_name} on system PATH")
75+
except:
76+
traceback.print_exc()
7677

7778

7879
class NavigationState():

0 commit comments

Comments
 (0)