Skip to content

Commit

Permalink
swc-installation-test-2.py: Use _ROOT_PATH for MS Windows compatability
Browse files Browse the repository at this point in the history
I don't think starting a path with os.sep gives you a root path on
Windows.  We need the backslash in _ROOT_PATH, because:

  os.path.join('c:', 'foo')

gives 'c:foo', a path relative to the current directory on drive C: [1].

[1]: http://docs.python.org/3/library/os.path.html#os.path.join
  • Loading branch information
W. Trevor King committed Mar 8, 2013
1 parent 8d8a62e commit e4d1199
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions setup/swc-installation-test-2.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ def import_module(name):

CHECKER = {}

_ROOT_PATH = _os.sep
if _platform.system() == 'win32':
_ROOT_PATH = 'c:\\'


class InvalidCheck (KeyError):
def __init__(self, check):
Expand Down Expand Up @@ -578,16 +582,16 @@ def _get_version(self):


for paths,name,long_name in [
([_os.path.join(_os.sep, 'Applications', 'Sublime Text 2.app')],
([_os.path.join(_ROOT_PATH, 'Applications', 'Sublime Text 2.app')],
'sublime-text', 'Sublime Text'),
([_os.path.join(_os.sep, 'Applications', 'TextMate.app')],
([_os.path.join(_ROOT_PATH, 'Applications', 'TextMate.app')],
'textmate', 'TextMate'),
([_os.path.join(_os.sep, 'Applications', 'TextWrangler.app')],
([_os.path.join(_ROOT_PATH, 'Applications', 'TextWrangler.app')],
'textwrangler', 'TextWrangler'),
([_os.path.join(_os.sep, 'Applications', 'Safari.app')],
([_os.path.join(_ROOT_PATH, 'Applications', 'Safari.app')],
'safari', 'Safari'),
([_os.path.join(_os.sep, 'Applications', 'Xcode.app'), # OS X >=1.7
_os.path.join(_os.sep, 'Developer', 'Applications', 'Xcode.app'
([_os.path.join(_ROOT_PATH, 'Applications', 'Xcode.app'), # OS X >=1.7
_os.path.join(_ROOT_PATH, 'Developer', 'Applications', 'Xcode.app'
) # OS X 1.6,
],
'xcode', 'Xcode'),
Expand Down

0 comments on commit e4d1199

Please sign in to comment.