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