| 1 | //go:build !windows && !darwin |
| 2 | |
| 3 | package main |
| 4 | |
| 5 | import "github.com/fsnotify/fsnotify" |
| 6 | |
| 7 | type fsnotifyWorkspaceWatcher struct { |
| 8 | watcher *fsnotify.Watcher |
| 9 | } |
| 10 | |
| 11 | func newWorkspaceWatcher() (workspaceWatcher, error) { |
| 12 | w, err := fsnotify.NewWatcher() |
| 13 | if err != nil { |
| 14 | return nil, err |
| 15 | } |
| 16 | return &fsnotifyWorkspaceWatcher{watcher: w}, nil |
| 17 | } |
| 18 | |
| 19 | func (w *fsnotifyWorkspaceWatcher) Events() <-chan fsnotify.Event { return w.watcher.Events } |
| 20 | func (w *fsnotifyWorkspaceWatcher) Errors() <-chan error { return w.watcher.Errors } |
| 21 | func (w *fsnotifyWorkspaceWatcher) SupportsRecursive() bool { return false } |
| 22 | func (w *fsnotifyWorkspaceWatcher) Add(path string, _ bool) error { return w.watcher.Add(path) } |
| 23 | func (w *fsnotifyWorkspaceWatcher) Remove(path string) error { return w.watcher.Remove(path) } |
| 24 | func (w *fsnotifyWorkspaceWatcher) Close() error { return w.watcher.Close() } |
| 25 |