github.com/DiversionCompany/notify@v0.9.9/event_fsevents.go (about) 1 // Copyright (c) 2014-2015 The Notify Authors. All rights reserved. 2 // Use of this source code is governed by the MIT license that can be 3 // found in the LICENSE file. 4 5 //go:build darwin && !kqueue && cgo 6 // +build darwin,!kqueue,cgo 7 8 package notify 9 10 const ( 11 osSpecificCreate = Event(FSEventsCreated) 12 osSpecificRemove = Event(FSEventsRemoved) 13 osSpecificWrite = Event(FSEventsModified) 14 osSpecificRename = Event(FSEventsRenamed) 15 // internal = Event(0x100000) 16 // recursive is used to distinguish recursive eventsets from non-recursive ones 17 recursive = Event(0x200000) 18 // omit is used for dispatching internal events; only those events are sent 19 // for which both the event and the watchpoint has omit in theirs event sets. 20 omit = Event(0x400000) 21 ) 22 23 // FSEvents specific event values. 24 const ( 25 FSEventsMustScanSubDirs Event = 0x00001 26 FSEventsUserDropped = 0x00002 27 FSEventsKernelDropped = 0x00004 28 FSEventsEventIdsWrapped = 0x00008 29 FSEventsHistoryDone = 0x00010 30 FSEventsRootChanged = 0x00020 31 FSEventsMount = 0x00040 32 FSEventsUnmount = 0x00080 33 FSEventsCreated = 0x00100 34 FSEventsRemoved = 0x00200 35 FSEventsInodeMetaMod = 0x00400 36 FSEventsRenamed = 0x00800 37 FSEventsModified = 0x01000 38 FSEventsFinderInfoMod = 0x02000 39 FSEventsChangeOwner = 0x04000 40 FSEventsXattrMod = 0x08000 41 FSEventsIsFile = 0x10000 42 FSEventsIsDir = 0x20000 43 FSEventsIsSymlink = 0x40000 44 ) 45 46 var osestr = map[Event]string{ 47 FSEventsMustScanSubDirs: "notify.FSEventsMustScanSubDirs", 48 FSEventsUserDropped: "notify.FSEventsUserDropped", 49 FSEventsKernelDropped: "notify.FSEventsKernelDropped", 50 FSEventsEventIdsWrapped: "notify.FSEventsEventIdsWrapped", 51 FSEventsHistoryDone: "notify.FSEventsHistoryDone", 52 FSEventsRootChanged: "notify.FSEventsRootChanged", 53 FSEventsMount: "notify.FSEventsMount", 54 FSEventsUnmount: "notify.FSEventsUnmount", 55 FSEventsInodeMetaMod: "notify.FSEventsInodeMetaMod", 56 FSEventsFinderInfoMod: "notify.FSEventsFinderInfoMod", 57 FSEventsChangeOwner: "notify.FSEventsChangeOwner", 58 FSEventsXattrMod: "notify.FSEventsXattrMod", 59 FSEventsIsFile: "notify.FSEventsIsFile", 60 FSEventsIsDir: "notify.FSEventsIsDir", 61 FSEventsIsSymlink: "notify.FSEventsIsSymlink", 62 } 63 64 type event struct { 65 fse FSEvent 66 event Event 67 } 68 69 func (ei *event) Event() Event { return ei.event } 70 func (ei *event) Path() string { return ei.fse.Path } 71 func (ei *event) Sys() interface{} { return &ei.fse } 72 func (ei *event) isDir() (bool, error) { return ei.fse.Flags&FSEventsIsDir != 0, nil }