Christian Ebert  committed 084358e

pybrowser: detect program names reliably

- cygwin: might be called *.exe
- gopher clients might also contain a path

  • Participants
  • Parent commits 42d4534
  • Branches default

Comments (0)

Files changed (1)

File muttils/

             self.weburl_re = u.url_re
+    def appname(self):
+        '''Extracts (text)browser name from /path/to/name(.exe).'''
+        return os.path.splitext(os.path.basename([0]
     def fixurl(self, url, cygpath):
         '''Adapts possibly short url to pass as browser argument.'''
         if not self.weburl_re or self.weburl_re.match(url):
             url = urlregex.webschemecomplete(url)
-            if url.startswith('gopher://') and not in gophers:
             gophers = 'lynx', 'firefox'
+            if url.startswith('gopher://') and self.appname() not in gophers:
                 # use gateway when browser is not gopher capable
                 url = url.replace('gopher://',
         textbrowsers = 'w3m', 'lynx', 'links', 'elinks'
         app, tb, notty, screen = '', False, False, False
         if is not None:
-            app = os.path.basename(
+            app = self.appname()
             tb = app in textbrowsers
             if tb:
                 notty = not util.termconnected()