]> go.fuhry.dev Git - fsnotify.git/commitdiff
remove internal uses of IsDelete() and friends
authorNathan Youngman <git@nathany.com>
Fri, 13 Jun 2014 05:07:09 +0000 (23:07 -0600)
committerNathan Youngman <git@nathany.com>
Fri, 13 Jun 2014 05:07:09 +0000 (23:07 -0600)
fsnotify_bsd.go
fsnotify_linux.go

index 0b38d1dbc0a4464b8de362015e962c8c9d3895f7..512eb42c958bc07bd001c9817471fff261d269de 100644 (file)
@@ -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)
index e7ca83829be92712b9b395bd74f264f71ae2bba4..3bc34b31d421260e59fa72e356365c871cf9be09 100644 (file)
@@ -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)
        }