From 432c817ae4d60300a5fbafd190ded5b93d992d5a Mon Sep 17 00:00:00 2001 From: Rob Figueiredo Date: Mon, 8 Oct 2012 22:36:22 -0400 Subject: [PATCH] Watch the directory even if it isn't a new watch. 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fsnotify_bsd.go b/fsnotify_bsd.go index 602bd4d..edafb99 100644 --- a/fsnotify_bsd.go +++ b/fsnotify_bsd.go @@ -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) -- 2.50.1