OpenPath opens the filetree at the given directory path. It reads all the files at the given path into this tree. Only paths listed in [Tree.Dirs] will be opened.
(path string)
| 100 | // OpenPath opens the filetree at the given directory path. It reads all the files at |
| 101 | // the given path into this tree. Only paths listed in [Tree.Dirs] will be opened. |
| 102 | func (ft *Tree) OpenPath(path string) *Tree { |
| 103 | if ft.FileNodeType == nil { |
| 104 | ft.FileNodeType = types.For[Node]() |
| 105 | } |
| 106 | effpath, err := filepath.EvalSymlinks(path) |
| 107 | if err != nil { |
| 108 | effpath = path |
| 109 | } |
| 110 | abs, err := filepath.Abs(effpath) |
| 111 | if errors.Log(err) != nil { |
| 112 | abs = effpath |
| 113 | } |
| 114 | ft.Filepath = core.Filename(abs) |
| 115 | ft.setDirOpen(core.Filename(abs)) |
| 116 | ft.initFileInfo() |
| 117 | ft.Open() |
| 118 | ft.Update() |
| 119 | return ft |
| 120 | } |
| 121 | |
| 122 | // UpdatePath updates the tree at the directory level for given path |
| 123 | // and everything below it. It flags that it needs render update, |