Filesystem notifications - panther, carbon and kqueue: an odyssey
Filesystem notifications - panther, carbon and kqueue: an odyssey
- Subject: Filesystem notifications - panther, carbon and kqueue: an odyssey
- From: John Clayton <email@hidden>
- Date: Wed, 26 Nov 2003 09:13:20 -0500
Ok,
An upfront disclaimer: I am a programmer who arrived at Objective-C via
Java and who has found myself backing up like a skittish horse into C
and the Unix underpinnings of OS X, which I love. I have the distinct
notion that I am traveling backwards in time on some quest to uncover
the Source-which I guess is sort of true. On the other hand, there's
been this nagging doubt creeping around the edges of my consciousness
for some time and which until now I have successfully REPRESSEDyou
can't really write a complete (and moderately complicated) application
in Cocoa using just Objective-C, you'll have to really learn C, Carbon,
etc.the voice says. You get the idea; my knowledge of the following
topic and historical solutions is pretty limited.
That being said, I started a week or so ago to scour the lists for some
tried-and-true to solutions to a challenge that I figured must be a
common one: to find out when the filesystem has changed in such a way
as to be interesting to my outline view. Ok, I see the system save
panel notices changes, so it must be possible. Approaches one finds
discussed on the list:
1) Poll the filesystem. As many say don't so this as bring it up. Ok,
next.
2) NSWorkspace has fileSytemHasChanged, which I call when my app
becomes active and which never seems to return anything but NO
regardless of what happens on the FS while my app is inactive. I don't
know why.
3) Carbon is the answer! FNSubscribe-it, baby. Ok, aside from the fact
that just looking over the API documentation for Carbon makes me feel
dizzy I'm willing to do this; I am after all starting to see the light
in C. I'm not scared. Ok, wait, what's an FSRef? Ahhhhh! Is this
going to take me a year to learn? I did find some very useful examples
here, but none of them complete enough to use out of the box; what did
I expect? But a serious question here: can someone suggest a learning
approach/tools to Carbon that is mostly structural and quick? I.e.
Where can I learn the basics quickly and get a lay of the land so I
might know where to look for answers? (The several books out there
have received mixed reviews).
4) Kqueue to-the-rescue. With panther there is an implementation of
kqueue at the BSD level. Fantastic! What's kqueue? Well a few links
on the list:
*
http://homepage.mac.com/calumr/main.m
*
http://people.freebsd.org/~jlemon/papers/kqueue.pdf
provide some insight. But I have so little knowledge of what is going
on here, I can't really evaluate whether this is my approach or not.
Seems promising. I am definitely looking deeper into this.
Summation: it would be great to see Cocoa support for some advanced
filesystem change detection techniques. Until then, can anyone shed
some light on the available options and recommend a best-practices
approach? I'd be eternally grateful. Well, grateful for a good long
while anyway.
Cheers,
John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.