A naive file watcher that uses the plain fsnotify API. Used on all non-Darwin systems (including Windows & Linux). All OS-specific codepaths are handled by fsnotify.
| 37 | // |
| 38 | // All OS-specific codepaths are handled by fsnotify. |
| 39 | type naiveNotify struct { |
| 40 | // Paths that we're watching that should be passed up to the caller. |
| 41 | // Note that we may have to watch ancestors of these paths |
| 42 | // in order to fulfill the API promise. |
| 43 | // |
| 44 | // We often need to check if paths are a child of a path in |
| 45 | // the notify list. It might be better to store this in a tree |
| 46 | // structure, so we can filter the list quickly. |
| 47 | notifyList map[string]bool |
| 48 | |
| 49 | isWatcherRecursive bool |
| 50 | watcher *fsnotify.Watcher |
| 51 | events chan fsnotify.Event |
| 52 | wrappedEvents chan FileEvent |
| 53 | errors chan error |
| 54 | numWatches int64 |
| 55 | } |
| 56 | |
| 57 | func (d *naiveNotify) Start() error { |
| 58 | if len(d.notifyList) == 0 { |
nothing calls this directly
no outgoing calls
no test coverage detected