From 8bb35ca5756a85f8098a2d2b3e8239e59f19e38c Mon Sep 17 00:00:00 2001 From: Clemens Mandl Date: Tue, 23 Jan 2018 11:08:58 +0100 Subject: [PATCH 1/2] Fixed a bug with multiple Sub-Directories with same name --- tools/export/nb/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/export/nb/__init__.py b/tools/export/nb/__init__.py index c435b0d37d..852a249860 100644 --- a/tools/export/nb/__init__.py +++ b/tools/export/nb/__init__.py @@ -325,9 +325,16 @@ class GNUARMNetbeans(Exporter): if cur_dir and prev_dir != cur_dir: # evaluate all matched items (from current and previous list) matched = [] - for element in dir_list: - if element in prev_dir_list: - matched.append(element) + # Compare the Element in Previous Dir with the Elements in Current Dir + # and add the Differences to the match-List + if len(dir_list) <= len(prev_dir_list): + for idx, element in enumerate(dir_list): + if element == prev_dir_list[idx]: + matched.append(element) + else: + for idx, element in enumerate(prev_dir_list): + if element == dir_list[idx]: + matched.append(element) # calculate difference between matched and length diff = dir_depth - len(matched) From 1ea22c1dd6c977de13c4faf599cbd8517127dab1 Mon Sep 17 00:00:00 2001 From: Clemens Mandl Date: Wed, 24 Jan 2018 13:49:24 +0100 Subject: [PATCH 2/2] Updated List comparision with shorter implementaion using python build-in function zip() --- tools/export/nb/__init__.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tools/export/nb/__init__.py b/tools/export/nb/__init__.py index 852a249860..5e73c6fca3 100644 --- a/tools/export/nb/__init__.py +++ b/tools/export/nb/__init__.py @@ -326,15 +326,10 @@ class GNUARMNetbeans(Exporter): # evaluate all matched items (from current and previous list) matched = [] # Compare the Element in Previous Dir with the Elements in Current Dir - # and add the Differences to the match-List - if len(dir_list) <= len(prev_dir_list): - for idx, element in enumerate(dir_list): - if element == prev_dir_list[idx]: - matched.append(element) - else: - for idx, element in enumerate(prev_dir_list): - if element == dir_list[idx]: - matched.append(element) + # and add the equal Elements to the match-List + for elem_prev_dir, elem_cur_dir in zip(prev_dir_list, dir_list): + if elem_prev_dir == elem_cur_dir: + matched.append(elem_cur_dir) # calculate difference between matched and length diff = dir_depth - len(matched)