Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Windows port: Monkeypatch os.path.join
Browse files Browse the repository at this point in the history
But only when executing in a MinGW/MSYS context.
This ensures backslashes are automatically replaced
by forward slashed so we don't trip up MSYS quoting
rules.

https://bugzilla.gnome.org/show_bug.cgi?id=620566
  • Loading branch information
dieterv committed Aug 5, 2012
1 parent 525ca57 commit b2804a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions giscanner/scannermain.py
Expand Up @@ -382,6 +382,9 @@ def scanner_main(args):
# on each Popen/call/check_call invocation
subprocess.Popen = utils.MsysPopen

# Monkeypatch os.path.join so '\\' separators are replaced with '/'
os.path.join = utils.msysjoin

parser = _get_option_parser()
(options, args) = parser.parse_args(args)

Expand Down
5 changes: 5 additions & 0 deletions giscanner/utils.py
Expand Up @@ -145,3 +145,8 @@ class MsysPopen(_Popen):
def __init__(self, args, **kwargs):
newargs = ['sh.exe', '-c', ' '.join(args)]
return _Popen.__init__(self, newargs, **kwargs)

_join = os.path.join
def msysjoin(a, *p):
path = _join(a, *p).replace('\\', '/')
return path

0 comments on commit b2804a3

Please sign in to comment.