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:
parent
fd329764ed
commit
d8ba3f746c
@ -140,9 +140,12 @@ def relative_path(original, base):
|
|||||||
# base path is normcase (lower case on Windows) so compare target in lower
|
# base path is normcase (lower case on Windows) so compare target in lower
|
||||||
# on Windows as well
|
# on Windows as well
|
||||||
for i in range(min(len(base_list), len(target_list))):
|
for i in range(min(len(base_list), len(target_list))):
|
||||||
if base_list[i] != (target_list[i].lower() if win()
|
if win():
|
||||||
else target_list[i]):
|
if base_list[i].lower() != target_list[i].lower():
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
if base_list[i] != target_list[i]:
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
#if break did not happen we are here at end, and add 1.
|
#if break did not happen we are here at end, and add 1.
|
||||||
i += 1
|
i += 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user