O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Watching Directories

One way fseventsd reduces the amount of data it, and other applications, have to slog through is by only reporting file system changes on a per-directory basis. If the user adds a file to ~/blah/, modifies a file in there, and deletes another file, you’ll only get one hey, ~/blah/ changed notification. It is up to you to decide what to do in that case. In order to figure out which file changed, you will need to have a cached copy of the contents of the directories and then compare. If you are implementing something like drop boxes, where putting a file in a directory causes some action to happen, you can just scan the directory for new files.

You can choose which directory hierarchies to watch, and you can choose whether ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required