tree.py
This commit is contained in:
parent
c0db9563cb
commit
aec7377780
Binary file not shown.
15
src/tree.py
15
src/tree.py
|
@ -60,6 +60,8 @@ class NerdTree():
|
|||
## rootnode for definition is always a folder
|
||||
rootnode = tosplit.split('/')[-1]
|
||||
|
||||
stat_dir_item = os.stat(startpath)
|
||||
|
||||
if path:
|
||||
path.append({
|
||||
'name' : rootnode,
|
||||
|
@ -79,6 +81,7 @@ class NerdTree():
|
|||
'abs_path' : startpath,
|
||||
'children' : [],
|
||||
'path': path,
|
||||
'size' : stat_dir_item.st_size,
|
||||
}
|
||||
|
||||
# using listdir
|
||||
|
@ -93,21 +96,25 @@ class NerdTree():
|
|||
if item in _tree_repr.ITEMS_TO_EXCLUDE:
|
||||
continue
|
||||
|
||||
if os.path.isdir(startpath+item):
|
||||
d['children'].append(self.tree_struct(startpath+item, path=path[:]))
|
||||
abs_path_item = startpath+item
|
||||
stat_item = os.stat(abs_path_item)
|
||||
|
||||
if os.path.isdir(abs_path_item):
|
||||
d['children'].append(self.tree_struct(abs_path_item, path=path[:]))
|
||||
else:
|
||||
path_copy = path[:]
|
||||
path_copy.append({
|
||||
'name' : item,
|
||||
'type' : 'f',
|
||||
'abs_path' : startpath + item
|
||||
'abs_path' : abs_path_item
|
||||
})
|
||||
|
||||
d['children'].append({
|
||||
'name' : item,
|
||||
'type' : 'f',
|
||||
'abs_path' : startpath + item,
|
||||
'abs_path' : abs_path_item,
|
||||
'path' : path_copy,
|
||||
'size' : stat_item.st_size,
|
||||
})
|
||||
|
||||
return d
|
||||
|
|
Loading…
Reference in New Issue