]> go.fuhry.dev Git - fsnotify.git/commitdiff
Watch the directory even if it isn't a new watch.
authorRob Figueiredo <robfig@gmail.com>
Tue, 9 Oct 2012 02:36:22 +0000 (22:36 -0400)
committerRob Figueiredo <robfig@gmail.com>
Tue, 9 Oct 2012 02:36:22 +0000 (22:36 -0400)
This fixes the issue where you watch directory and then its
subdirectory, the subdirectory does not have all its files watched (via
watchDirectoryFiles)

fsnotify_bsd.go

index 602bd4dd90648447c9b6b9b05d59839db07b8f24..edafb99bb2f76c12321c06597df8ac0c0550c07a 100644 (file)
@@ -139,10 +139,12 @@ func (w *Watcher) addWatch(path string, flags uint32) error {
                w.paths[watchfd] = path
 
                w.finfo[watchfd] = fi
-               if fi.IsDir() && (flags&NOTE_WRITE) == NOTE_WRITE {
-                       watchDir = true
-               }
        }
+       
+       if w.finfo[watchfd].IsDir() && (flags&NOTE_WRITE) == NOTE_WRITE {
+               watchDir = true
+       }
+
        syscall.SetKevent(watchEntry, watchfd, syscall.EVFILT_VNODE, syscall.EV_ADD|syscall.EV_CLEAR)
 
        wd, errno := syscall.Kevent(w.kq, w.kbuf[:], nil, nil)