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

Method watchPath

filetree/tree.go:218–238  ·  view source on GitHub ↗

watchPath adds given path to those watched

(path core.Filename)

Source from the content-addressed store, hash-verified

216
217// watchPath adds given path to those watched
218func (ft *Tree) watchPath(path core.Filename) error {
219 return nil // TODO: disable for all platforms for now -- getting some issues
220 if core.TheApp.Platform() == system.MacOS {
221 return nil // mac is not supported in a high-capacity fashion at this point
222 }
223 rp := ft.RelativePathFrom(path)
224 on, has := ft.watchedPaths[rp]
225 if on || has {
226 return nil
227 }
228 ft.configWatcher()
229 // fmt.Printf("watching path: %s\n", path)
230 err := ft.watcher.Add(string(path))
231 if err == nil {
232 ft.watchedPaths[rp] = true
233 ft.watchWatcher()
234 } else {
235 slog.Error(err.Error())
236 }
237 return err
238}
239
240// unWatchPath removes given path from those watched
241func (ft *Tree) unWatchPath(path core.Filename) {

Callers 1

setDirOpenMethod · 0.95

Calls 6

configWatcherMethod · 0.95
watchWatcherMethod · 0.95
RelativePathFromMethod · 0.80
PlatformMethod · 0.65
AddMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected