summarylogtreecommitdiffstats
path: root/jack_lsp-check.diff
blob: e0de19c9b322159098f401387ef448f4605b95c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff --git a/gtk-recordmydesktop/src/rmdPrefsWidget.py b/gtk-recordmydesktop/src/rmdPrefsWidget.py
index 0257ba9..e8a493f 100644
--- a/gtk-recordmydesktop/src/rmdPrefsWidget.py
+++ b/gtk-recordmydesktop/src/rmdPrefsWidget.py
@@ -323,11 +323,33 @@ class prefsWidget(object):
         for i in range(4):
             self.labelbox[i].show()
         self.notebook.show()
+
+    def which(self,program):
+        import os
+        def is_exe(fpath):
+            return os.path.exists(fpath) and os.access(fpath, os.X_OK)
+
+        fpath, fname = os.path.split(program)
+        if fpath:
+            if is_exe(program):
+                return program
+        else:
+            for path in os.environ["PATH"].split(os.pathsep):
+                exe_file = os.path.join(path, program)
+                if is_exe(exe_file):
+                    return exe_file
+
+        return None
+
+
     def __runJackLSP__(self,button=None):
         if button!=None:
             self.__getSelectedPorts__()
         self.ports=[]
         failed=0
+        if self.which('jack_lsp') == None:
+            self.jack_button.set_sensitive(False)
+            return
         (stdin,stdout,stderr)=os.popen3(['jack_lsp'],'t')
         ports=stdout.readlines()
         stdin.close()