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

Method OpenPath

filetree/tree.go:102–120  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
102func (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,

Callers 1

TestTreeFunction · 0.80

Calls 7

setDirOpenMethod · 0.95
OpenMethod · 0.95
LogFunction · 0.92
FilenameTypeAlias · 0.92
initFileInfoMethod · 0.80
UpdateMethod · 0.65
AbsMethod · 0.45

Tested by 1

TestTreeFunction · 0.64