diff options
author | Doug Hammond <doughammond@hamsterfight.co.uk> | 2011-02-21 04:11:35 +0300 |
---|---|---|
committer | Doug Hammond <doughammond@hamsterfight.co.uk> | 2011-02-21 04:11:35 +0300 |
commit | b37d5536ac96c1638a7957703995d8563cebb2f3 (patch) | |
tree | 8729df9d04c2ec094a5b5d8839d6dc0400f44e6e /modules | |
parent | 9d2ee8055a510dd41036c780c6209dc4d7d80c72 (diff) |
extensions_framework: make util.path_relative_to_export more robust on win32
Diffstat (limited to 'modules')
-rw-r--r-- | modules/extensions_framework/util.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/extensions_framework/util.py b/modules/extensions_framework/util.py index b210e729..93d31f64 100644 --- a/modules/extensions_framework/util.py +++ b/modules/extensions_framework/util.py @@ -52,8 +52,15 @@ def path_relative_to_export(p): """Return a path that is relative to the export path""" global export_path p = filesystem_path(p) + ep = os.path.dirname(export_path) + + if os.sys.platform == 'win32': + # Prevent an error whereby python thinks C: and c: are different drives + if p[1] == ':': p = p[0].lower() + p[1:] + if ep[1] == ':': ep = ep[0].lower() + ep[1:] + try: - relp = os.path.relpath(p, os.path.dirname(export_path)) + relp = os.path.relpath(p, ep) except ValueError: # path on different drive on windows relp = p |