Unnecessarily long relative paths generated on Windows

The relative_path file utility function returns paths with '..\..'
on Windows unnecessarily.

fixes #10087
This commit is contained in:
prculley 2017-06-18 09:46:40 -05:00 committed by Nick Hall
parent fd329764ed
commit d8ba3f746c

View File

@ -140,9 +140,12 @@ def relative_path(original, base):
# base path is normcase (lower case on Windows) so compare target in lower
# on Windows as well
for i in range(min(len(base_list), len(target_list))):
if base_list[i] != (target_list[i].lower() if win()
else target_list[i]):
break
if win():
if base_list[i].lower() != target_list[i].lower():
break
else:
if base_list[i] != target_list[i]:
break
else:
#if break did not happen we are here at end, and add 1.
i += 1