MCPcopy Create free account
hub / github.com/cogentcore/core / UpdatePath

Method UpdatePath

filetree/tree.go:126–142  ·  view source on GitHub ↗

UpdatePath updates the tree at the directory level for given path and everything below it. It flags that it needs render update, but if a deletion or insertion happened, then NeedsLayout should also be called.

(path string)

Source from the content-addressed store, hash-verified

124// but if a deletion or insertion happened, then NeedsLayout should also
125// be called.
126func (ft *Tree) UpdatePath(path string) {
127 ft.NeedsRender()
128 path = filepath.Clean(path)
129 ft.dirsTo(path)
130 if fn, ok := ft.FindFile(path); ok {
131 if fn.IsDir() {
132 fn.Update()
133 return
134 }
135 }
136 fpath, _ := filepath.Split(path)
137 if fn, ok := ft.FindFile(fpath); ok {
138 fn.Update()
139 return
140 }
141 // core.MessageSnackbar(ft, "UpdatePath: path not found in tree: "+path)
142}
143
144// configWatcher configures a new watcher for tree
145func (ft *Tree) configWatcher() error {

Callers 4

RenameFileMethod · 0.80
newFileMethod · 0.80
newFolderMethod · 0.80
copyFileToDirMethod · 0.80

Calls 6

NeedsRenderMethod · 0.80
dirsToMethod · 0.80
FindFileMethod · 0.80
SplitMethod · 0.80
UpdateMethod · 0.65
IsDirMethod · 0.45

Tested by

no test coverage detected