From d09447fe021dc47f676724ada889a6c6fa6efb84 Mon Sep 17 00:00:00 2001 From: Chris Howey Date: Fri, 30 Mar 2012 19:00:57 -0500 Subject: [PATCH] Windows - roll attributes into notify --- fsnotify.go | 4 ---- fsnotify_test.go | 2 +- fsnotify_windows.go | 9 +++------ 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/fsnotify.go b/fsnotify.go index 1381c2a..023665e 100644 --- a/fsnotify.go +++ b/fsnotify.go @@ -19,10 +19,6 @@ func (e *FileEvent) String() string { events += "|" + "MODIFY" } - if e.IsAttribute() { - events += "|" + "ATTRIB" - } - if e.IsRename() { events += "|" + "RENAME" } diff --git a/fsnotify_test.go b/fsnotify_test.go index 7979201..3561599 100644 --- a/fsnotify_test.go +++ b/fsnotify_test.go @@ -255,7 +255,7 @@ func TestFsnotifyAttrib(t *testing.T) { for event := range eventstream { // Only count relevant events if event.Name == testDir || event.Name == testFile { - if event.IsAttribute() { + if event.IsModify() { attribReceived++ } t.Logf("event received: %s", event) diff --git a/fsnotify_windows.go b/fsnotify_windows.go index 1af4079..5ab54c0 100644 --- a/fsnotify_windows.go +++ b/fsnotify_windows.go @@ -30,13 +30,10 @@ type FileEvent struct { func (e *FileEvent) IsCreate() bool { return (e.mask & FS_CREATE) == FS_CREATE} // IsDelete reports whether the FileEvent was triggerd by a delete -func (e *FileEvent) IsDelete() bool { return ((e.mask & FS_DELETE) == FS_DELETE || (e.mask & FS_DELETE_SELF) == FS_DELETE_SELF } +func (e *FileEvent) IsDelete() bool { return ((e.mask & FS_DELETE) == FS_DELETE || (e.mask & FS_DELETE_SELF) == FS_DELETE_SELF) } -// IsModify reports whether the FileEvent was triggerd by a file modification -func (e *FileEvent) IsModify() bool { return (e.mask & FS_MODIFY) == FS_MODIFY } - -// IsAttribute reports whether the FileEvent was triggerd by a change of attributes -func (e *FileEvent) IsAttribute() bool { return (e.mask & FS_ATTRIB) == FS_ATTRIB } +// IsModify reports whether the FileEvent was triggerd by a file modification or attribute change +func (e *FileEvent) IsModify() bool { return ((e.mask & FS_MODIFY) == FS_MODIFY || (e.mask & FS_ATTRIB) == FS_ATTRIB) } // IsRename reports whether the FileEvent was triggerd by a change name func (e *FileEvent) IsRename() bool { return ((e.mask & FS_MOVE) == FS_MOVE || (e.mask & FS_MOVE_SELF) == FS_MOVE_SELF || (e.mask & FS_MOVED_FROM) == FS_MOVED_FROM || (e.mask & FS_MOVED_TO) == FS_MOVED_TO) } -- 2.50.1