Reputation: 14251
In the Windows API, when you monitor a directory, the callback provides what changed. How do I accomplish the same for Mac OS X?
I looked at the File System Events API and the Kernel Events API and it seems like they both watch a file descriptor and return what changes happened to that file descriptor. This is inconvenient because now I have to open watchers on the entire file structure and remember the previous names (in case of a rename).
Is there a better way (that doesn't involve a library)?
Upvotes: 4
Views: 3126
Reputation: 385500
FSEvents watches a directory hierarchy (or multiple hierarchies), not a file descriptor. So you only need one watcher. But you will need to scan the directories to find out which files changed. There is no better way (that doesn't involve a library).
Upvotes: 2