Added Print() Method to FileNode Struct
This Method Is Useful for Printing the Children of the Node recursively. Useful for debugging Purpose.
This commit is contained in:
parent
99e0e8e615
commit
91de613758
@ -46,6 +46,18 @@ func generateDirectoryTree(path [] string) *FileNode{
|
||||
}
|
||||
head = head1
|
||||
}
|
||||
fmt.Println(head)
|
||||
return head
|
||||
}
|
||||
|
||||
func (f FileNode) Print(count int){
|
||||
if (len(f.children) == 0){
|
||||
return
|
||||
} else{
|
||||
for i := range f.children{
|
||||
for j := 0 ; j < count ; j++ {
|
||||
fmt.Print("---")
|
||||
}; fmt.Println(f.children[i].path)
|
||||
f.children[i].Print(count + 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user