Documentation ¶
Overview ¶
Package dirtree contains the DirTree type which is used for building filesystem hierarchies in memory.
Index ¶
- type DirTree
- func (dt DirTree) Add(entry fs.DirEntry)
- func (dt DirTree) AddDir(entry fs.DirEntry)
- func (dt DirTree) AddEntry(entry fs.DirEntry)
- func (dt DirTree) CheckParents(root string)
- func (dt DirTree) Dirs() (dirNames []string)
- func (dt DirTree) Find(filePath string) (parentPath string, entry fs.DirEntry)
- func (dt DirTree) Prune(dirNames map[string]bool) error
- func (dt DirTree) Sort()
- func (dt DirTree) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirTree ¶
type DirTree map[string]fs.DirEntries
DirTree is a map of directories to entries
func (DirTree) AddDir ¶
AddDir adds a directory entry to the tree this creates the directory itself if required it doesn't create parents
func (DirTree) AddEntry ¶
AddEntry adds the entry and creates the parents for it regardless of whether it is a file or a directory.
func (DirTree) CheckParents ¶
CheckParents checks every directory in the tree has *Dir in its parent
func (DirTree) Find ¶
Find returns the DirEntry for filePath or nil if not found
None that Find does a O(N) search so can be slow
Click to show internal directories.
Click to hide internal directories.