@@ -309,18 +309,15 @@ def get_netbeans_file_list(file_list):
309
309
output = []
310
310
prev_dir = ''
311
311
folder_count = 1
312
- for idx , item in enumerate (file_list ):
312
+ dir_depth = 0
313
+ for item in (file_list ):
313
314
cur_dir = os .path .dirname (item )
314
315
dir_temp = os .path .normpath (cur_dir )
315
316
prev_dir_temp = os .path .normpath (prev_dir )
316
317
dir_list = dir_temp .split (os .sep )
317
318
prev_dir_list = prev_dir_temp .split (os .sep )
318
319
dir_depth = len (dir_list )
319
320
320
- # print 'PREV_DIR: ' + str(prev_dir_list)
321
-
322
- # print 'CURR_DIR: ' + str(dir_list)
323
-
324
321
# Current File is in Directory: Compare the given dir with previous Dir
325
322
if cur_dir and prev_dir != cur_dir :
326
323
# evaluate all matched items (from current and previous list)
@@ -332,8 +329,6 @@ def get_netbeans_file_list(file_list):
332
329
# calculate difference between matched and length
333
330
diff = dir_depth - len (matched )
334
331
335
- # print 'MATCHED: ' + str(matched)
336
-
337
332
# if previous dir was not root
338
333
if prev_dir != '' :
339
334
# if the elements count is not equal we calculate the difference
@@ -364,10 +359,10 @@ def get_netbeans_file_list(file_list):
364
359
# Save the Current Dir
365
360
prev_dir = cur_dir
366
361
output .append ('<itemPath>' + str (item ) + '</itemPath>' )
367
- # if last iteration close all open tags
368
- if idx == len ( file_list ) - 1 and cur_dir != '' :
369
- for i in range ( 0 , len ( dir_list )):
370
- output .append ('</logicalFolder>' )
362
+
363
+ if cur_dir != '' :
364
+ # close all open tags
365
+ output .append ('</logicalFolder>' * dir_depth )
371
366
372
367
return output
373
368
0 commit comments