From: Nathan Youngman Date: Fri, 13 Jun 2014 05:07:09 +0000 (-0600) Subject: remove internal uses of IsDelete() and friends X-Git-Tag: v1.7.2~312^2~2 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=bfad0429ff445d20f2386cab3641c8621b10914e;p=fsnotify.git remove internal uses of IsDelete() and friends --- diff --git a/fsnotify_bsd.go b/fsnotify_bsd.go index 0b38d1d..512eb42 100644 --- a/fsnotify_bsd.go +++ b/fsnotify_bsd.go @@ -370,7 +370,7 @@ func (w *Watcher) readEvents() { fileEvent := newEvent(name, mask, false) - if fileInfo != nil && fileInfo.IsDir() && !fileEvent.IsDelete() { + if fileInfo != nil && fileInfo.IsDir() && !(fileEvent.Op&Remove == Remove) { // Double check to make sure the directory exist. This can happen when // we do a rm -fr on a recursively watched folders and we receive a // modification event first but the folder has been deleted and later @@ -381,7 +381,7 @@ func (w *Watcher) readEvents() { } } - if fileInfo != nil && fileInfo.IsDir() && fileEvent.IsModify() && !fileEvent.IsDelete() { + if fileInfo != nil && fileInfo.IsDir() && fileEvent.Op&Write == Write && !(fileEvent.Op&Remove == Remove) { w.sendDirectoryChangeEvents(fileEvent.Name) } else { // Send the event on the events channel @@ -391,13 +391,13 @@ func (w *Watcher) readEvents() { // Move to next event events = events[1:] - if fileEvent.IsRename() { + if fileEvent.Op&Rename == Rename { w.removeWatch(fileEvent.Name) w.femut.Lock() delete(w.fileExists, fileEvent.Name) w.femut.Unlock() } - if fileEvent.IsDelete() { + if fileEvent.Op&Remove == Remove { w.removeWatch(fileEvent.Name) w.femut.Lock() delete(w.fileExists, fileEvent.Name) diff --git a/fsnotify_linux.go b/fsnotify_linux.go index e7ca838..3bc34b3 100644 --- a/fsnotify_linux.go +++ b/fsnotify_linux.go @@ -304,7 +304,7 @@ func (e *Event) ignoreLinux() bool { // *Note*: this was put in place because it was seen that a MODIFY // event was sent after the DELETE. This ignores that MODIFY and // assumes a DELETE will come or has come if the file doesn't exist. - if !(e.IsDelete() || e.IsRename()) { + if !(e.Op&Remove == Remove || e.Op&Rename == Rename) { _, statErr := os.Lstat(e.Name) return os.IsNotExist(statErr) }