More "relpath" try/except protection...

This commit is contained in:
Bastien Montagne
2013-08-18 15:17:33 +00:00
parent c5e14f62a6
commit a567dd20c0
3 changed files with 22 additions and 7 deletions

View File

@@ -409,7 +409,10 @@ def path_reference(filepath,
if mode == 'ABSOLUTE':
return filepath_abs
elif mode == 'RELATIVE':
return os.path.relpath(filepath_abs, base_dst)
try: # can't always find the relative path (between drive letters on windows)
return os.path.relpath(filepath_abs, base_dst)
except ValueError:
return filepath_abs
elif mode == 'STRIP':
return os.path.basename(filepath_abs)