From 9e5046297b436e9d040fe98571dcd059b7916db2 Mon Sep 17 00:00:00 2001 From: Nathan Youngman Date: Sun, 14 Sep 2014 17:40:15 -0600 Subject: [PATCH] FIXME: something doesn't seem quite right Ref: https://github.com/go-fsnotify/fsnotify/blob/v0.9.0/fsnotify_bsd.go#L384 --- kqueue.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kqueue.go b/kqueue.go index 99441a2..9af190c 100644 --- a/kqueue.go +++ b/kqueue.go @@ -327,20 +327,21 @@ func (w *Watcher) readEvents() { delete(w.fileExists, event.Name) w.femut.Unlock() - // Look for a file that may have overwritten this - // (ie mv f1 f2 will delete f2 then create f2) + // Look for a file that may have overwritten this. + // For example, mv f1 f2 will delete f2, then create f2. fileDir, _ := filepath.Split(event.Name) fileDir = filepath.Clean(fileDir) w.wmut.Lock() _, found := w.watches[fileDir] w.wmut.Unlock() if found { - // make sure the directory exist before we watch for changes. When we + // make sure the directory exists before we watch for changes. When we // do a recursive watch and perform rm -fr, the parent directory might // have gone missing, ignore the missing directory and let the // upcoming delete event remove the watch from the parent directory. - if _, err := os.Lstat(fileDir); !os.IsNotExist(err) { + if _, err := os.Lstat(fileDir); os.IsExist(err) { w.sendDirectoryChangeEvents(fileDir) + // FIXME: should this be for events on files or just isDir? } } } -- 2.50.1