Skip to content
Snippets Groups Projects
Commit b37d5536 authored by Doug Hammond's avatar Doug Hammond
Browse files

extensions_framework: make util.path_relative_to_export more robust on win32

parent 9d2ee805
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment