mirror of https://github.com/ARMmbed/mbed-os.git
Refactoring of function get_netbeans_file_list(file_list) to have a clearer code
parent
61461bcc43
commit
52839aaa91
|
@ -309,7 +309,8 @@ class GNUARMNetbeans(Exporter):
|
|||
output = []
|
||||
prev_dir = ''
|
||||
folder_count = 1
|
||||
for idx, item in enumerate(file_list):
|
||||
dir_depth = 0
|
||||
for item in (file_list):
|
||||
cur_dir = os.path.dirname(item)
|
||||
dir_temp = os.path.normpath(cur_dir)
|
||||
prev_dir_temp = os.path.normpath(prev_dir)
|
||||
|
@ -317,10 +318,6 @@ class GNUARMNetbeans(Exporter):
|
|||
prev_dir_list = prev_dir_temp.split(os.sep)
|
||||
dir_depth = len(dir_list)
|
||||
|
||||
# print 'PREV_DIR: ' + str(prev_dir_list)
|
||||
|
||||
# print 'CURR_DIR: ' + str(dir_list)
|
||||
|
||||
# Current File is in Directory: Compare the given dir with previous Dir
|
||||
if cur_dir and prev_dir != cur_dir:
|
||||
# evaluate all matched items (from current and previous list)
|
||||
|
@ -332,8 +329,6 @@ class GNUARMNetbeans(Exporter):
|
|||
# calculate difference between matched and length
|
||||
diff = dir_depth - len(matched)
|
||||
|
||||
# print 'MATCHED: ' + str(matched)
|
||||
|
||||
# if previous dir was not root
|
||||
if prev_dir != '':
|
||||
# if the elements count is not equal we calculate the difference
|
||||
|
@ -364,10 +359,10 @@ class GNUARMNetbeans(Exporter):
|
|||
# Save the Current Dir
|
||||
prev_dir = cur_dir
|
||||
output.append('<itemPath>' + str(item) + '</itemPath>')
|
||||
# if last iteration close all open tags
|
||||
if idx == len(file_list) - 1 and cur_dir != '':
|
||||
for i in range(0, len(dir_list)):
|
||||
output.append('</logicalFolder>')
|
||||
|
||||
if cur_dir != '':
|
||||
# close all open tags
|
||||
output.append('</logicalFolder>' * dir_depth)
|
||||
|
||||
return output
|
||||
|
||||
|
|
Loading…
Reference in New Issue