From: Nathan Youngman Date: Sun, 14 Sep 2014 23:40:15 +0000 (-0600) Subject: FIXME: something doesn't seem quite right X-Git-Tag: v1.7.2~258 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=9e5046297b436e9d040fe98571dcd059b7916db2;p=fsnotify.git FIXME: something doesn't seem quite right Ref: https://github.com/go-fsnotify/fsnotify/blob/v0.9.0/fsnotify_bsd.go#L384 --- 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? } } }