Skip to content

Commit b857c91

Browse files
committed
Don't crash on unsupported platforms, display a dialog instead
1 parent 2ed0651 commit b857c91

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

openbash/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
'''
44

55
import subprocess
6-
from fman import DirectoryPaneCommand, show_alert
6+
import platform
7+
from fman import DirectoryPaneCommand, show_alert, run_application_command, get_application_commands
78
from fman.url import splitscheme, as_human_readable
89

910
class OpenBash(DirectoryPaneCommand):
@@ -17,5 +18,10 @@ def __call__(self):
1718
show_alert('Not supported.')
1819
return
1920
local_path = as_human_readable(url)
20-
subprocess.call('C:/Program Files/Git/git-bash.exe --cd="{cd}"'.format(
21-
cd=local_path))
21+
if platform.system() == 'Windows':
22+
subprocess.call('C:/Program Files/Git/git-bash.exe --cd="{cd}"'.format(
23+
cd=local_path))
24+
else:
25+
show_alert(
26+
"Sorry, this plugin is supposed to run on Windows. "
27+
"Use the built-in 'Open terminal' command on other platforms.")

0 commit comments

Comments
 (0)