Re: File changed notification
Re: File changed notification
- Subject: Re: File changed notification
- From: Uli Kusterer <email@hidden>
- Date: Fri, 4 Aug 2006 20:33:53 +0200
Am 04.08.2006 um 17:47 schrieb Paul Schulze:
Is there a recommended way to listen to changes of files? I'm
trying to write an application, that provides information about
various files, that may be distributed over the whole home
directory of a user. I would like to simply register the file, I'm
watching and then get an event call on changes. Is there any way to
do this? Couldn't find anything by now, so any hint would be nice.
If you can require 10.3 or later, kqueue is your friend. If you
want a Cocoa wrapper, I wrote one:
http://www.zathras.de/angelweb/sourcecode.htm#UKKQueue
It also contains an FNSubscribe-based file watching mechanism, which
is the other scheme Apple provides. Both have their advantages and
disadvantages.
Be careful, though. Many apps (especially Cocoa ones) don't change
files, but rather write a new one with the changed contents and then
swap them out once the new one has successfully been written. So, you
may only get one "delete" notification instead of a change.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden