Show files with same name but different path

This commit is contained in:
Sebastian Serth
2021-12-14 23:46:24 +01:00
parent 46cb5e57f9
commit 88fb04080f

View File

@ -29,7 +29,7 @@ class FileTree
# Our tree needs a root node, but we won't display it. # Our tree needs a root node, but we won't display it.
@root = Tree::TreeNode.new('ROOT') @root = Tree::TreeNode.new('ROOT')
files.uniq(&:name_with_extension).each do |file| files.uniq(&:filepath).each do |file|
parent = @root parent = @root
(file.path || '').split('/').each do |segment| (file.path || '').split('/').each do |segment|
node = parent.children.detect {|child| child.name == segment } || parent.add(Tree::TreeNode.new(segment)) node = parent.children.detect {|child| child.name == segment } || parent.add(Tree::TreeNode.new(segment))