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)
| 124 | // but if a deletion or insertion happened, then NeedsLayout should also |
| 125 | // be called. |
| 126 | func (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 |
| 145 | func (ft *Tree) configWatcher() error { |
no test coverage detected