Commits

Christian Ebert committed 7bcfcb2

pybrowser: move cygwin path transformation after file existence check

* file protocol is correctly prepended
* more logical inside local if-fork

Comments (0)

Files changed (1)

muttils/pybrowser.py

 # $Id$
 
-import os, platform, webbrowser
+import os, webbrowser, sys
 from muttils import ui, urlregex, util
 
 class browser(object):
         self.ui = parentui or ui.ui()
         self.ui.updateconfig()
         self.items = items             # urls
-        self.cygpath = platform.system().find('CYGWIN') > -1
         if app is not None:
             self.ui.app = app
         if evalurl: # check remote url protocol scheme
                 # use gateway when browser is not gopher capable
                 url = url.replace('gopher://',
                                   'http://gopher.floodgap.com/gopher/gw?')
-        elif self.cygpath:
-            # cygwin expects windows filesystem path
-            url = util.pipeline(['cygpath', '-w', url]).rstrip()
         else: # local
             if url.startswith('file:'):
                 # drop scheme in favour of local path
                 url = util.absolutepath(url)
                 if not os.path.exists(url):
                     raise util.DeadMan('%s: not found' % url)
+                if sys.platform == 'cygwin':
+                    # cygwin expects windows filesystem path for system
+                    # browsers
+                    url = util.pipeline(['cygpath', '-w', url]).rstrip()
                 url = 'file://' + url
         return url