From d8ba3f746c46d9f4583a3e18e98d181af69adc99 Mon Sep 17 00:00:00 2001 From: prculley Date: Sun, 18 Jun 2017 09:46:40 -0500 Subject: [PATCH] Unnecessarily long relative paths generated on Windows The relative_path file utility function returns paths with '..\..' on Windows unnecessarily. fixes #10087 --- gramps/gen/utils/file.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gramps/gen/utils/file.py b/gramps/gen/utils/file.py index 24efdf76a..c819059a4 100644 --- a/gramps/gen/utils/file.py +++ b/gramps/gen/utils/file.py @@ -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