]> go.fuhry.dev Git - fsnotify.git/commitdiff
BSD: Auto add watch on file creation to match linux
authorChris Howey <chris@howey.me>
Tue, 18 Oct 2011 12:38:05 +0000 (05:38 -0700)
committerChris Howey <chris@howey.me>
Tue, 18 Oct 2011 12:38:05 +0000 (05:38 -0700)
fsnotify_bsd.go

index 3375c9b6354c06ce1ddc030cc8df0b107ce3636b..d9d77541d7080fb3e8947613ade07687445c188c 100644 (file)
@@ -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