Skip to content

Commit

Permalink
Windows - roll attributes into notify
Browse files Browse the repository at this point in the history
  • Loading branch information
howeyc committed Mar 31, 2012
1 parent 27e5353 commit d09447f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 0 additions & 4 deletions fsnotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ func (e *FileEvent) String() string {
events += "|" + "MODIFY"
}

if e.IsAttribute() {
events += "|" + "ATTRIB"
}

if e.IsRename() {
events += "|" + "RENAME"
}
Expand Down
2 changes: 1 addition & 1 deletion fsnotify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 3 additions & 6 deletions fsnotify_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down

0 comments on commit d09447f

Please sign in to comment.