From: Chris Howey Date: Tue, 18 Oct 2011 12:38:05 +0000 (-0700) Subject: BSD: Auto add watch on file creation to match linux X-Git-Tag: v1.7.2~460 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=84058fc68ef2f9f110e2eefb3f6320fbe4d76cc4;p=fsnotify.git BSD: Auto add watch on file creation to match linux --- diff --git a/fsnotify_bsd.go b/fsnotify_bsd.go index 3375c9b..d9d7754 100644 --- a/fsnotify_bsd.go +++ b/fsnotify_bsd.go @@ -248,6 +248,9 @@ func (w *Watcher) sendDirectoryChangeEvents(dirPath string) { if fileInfo.IsRegular() == true { filePath := path.Join(dirPath, fileInfo.Name) if w.watches[filePath] == 0 { + // Watch file to mimic linux fsnotify + w.addWatch(filePath, NOTE_DELETE|NOTE_WRITE|NOTE_RENAME) + // Send create event fileEvent := new(FileEvent) fileEvent.Name = filePath