According to Apple documentation, in the callback to FSEvents
,
/* These flags are only set if you specified the FileEvents */
/* flags when creating the stream. */
kFSEventStreamEventFlagItemCreated = 0x00000100,
kFSEventStreamEventFlagItemRemoved = 0x00000200,
kFSEventStreamEventFlagItemInodeMetaMod = 0x00000400,
kFSEventStreamEventFlagItemRenamed = 0x00000800,
kFSEventStreamEventFlagItemModified = 0x00001000,
kFSEventStreamEventFlagItemFinderInfoMod = 0x00002000,
kFSEventStreamEventFlagItemChangeOwner = 0x00004000,
kFSEventStreamEventFlagItemXattrMod = 0x00008000,
kFSEventStreamEventFlagItemIsFile = 0x00010000,
kFSEventStreamEventFlagItemIsDir = 0x00020000,
kFSEventStreamEventFlagItemIsSymlink = 0x00040000
However, I triple checked that the kFSEventStreamCreateFlagFileEvents
flag is not being set when calling
FSEventStreamRef FSEventStreamCreate(
CFAllocatorRef allocator,
FSEventStreamCallback callback,
FSEventStreamContext *context,
CFArrayRef pathsToWatch,
FSEventStreamEventId sinceWhen,
CFTimeInterval latency,
FSEventStreamCreateFlags flags);
But no matter what I do, the kFSEventStreamEventFlagItem*
flags are still being set when the events are passed to me from the FSEvents
API. I suspect this is a bug, but I'm not quite sure. I'm using OS X Lion 10.7.2
Sample code can be found here. http://stuconnolly.com/downloads/scevents/
EDIT
The question is:
Has anyone else experienced the same results?
Is this a behavior I can rely on to check for the file event flags?
In fact,these flags are set normally although the flag looks wrong.
For example,you got a flag 133120.That is 0x20800. So,you should notice "kFSEventStreamEventFlagItemRenamed = 0x00000800" and "kFSEventStreamEventFlagItemIsDir = 0x00020000".
That is to say, kFSEventStreamEventFlagItemRenamed & kFSEventStreamEventFlagItemIsDir are what you want.
User contributions licensed under CC BY-SA 3.0