Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: filesystem notifications



In my case, I have a document which is maintaining a view of the file system at a given directory. (a la Finder)

so I fire off an NSTimer with an interval of 1 second that calls a method which calls NSFileManager fileAttributesAtPath: and gets fileModificationDate from that dictionary then does a compare: with the cached date I had when I first opened the directory. If the directory changed, then I refresh my view.

I was concerned about the performance hit, to the point where I even benchmarked a bsd fstat() version against this, which was quite a bit faster, but as it turned out the Foundation version was taking less than a millisecond, so I figured I'd just use it, gaining back 0.1% of the cpu didn't seem worth it.


On Monday, May 28, 2001, at 06:53 PM, Rob Rix wrote:

The problem with this method is it misses all changes that don't send NSWorkspace noteFileSystemChanged messages, which seems to be almost all of them.

e.g. downloads from most tools, anything happening at the BSD layer, shell access, etc.

Unfortunately, you're exactly right there.

You have to resort to polling the file system itself to keep up to date.

How do you do this?


References: 
 >Re: filesystem notifications (From: Rob Rix <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.