Re: Find the 'Application Support' folder
Re: Find the 'Application Support' folder
- Subject: Re: Find the 'Application Support' folder
- From: John Stiles <email@hidden>
- Date: Tue, 12 Oct 2004 09:40:46 -0700
On Oct 12, 2004, at 9:21 AM, Charles Srstka wrote:
FSFindFolder works, but I have always wondered why Apple hasn't built
in a Cocoa API for accessing these folders. Having to go through
Carbon to do this is kind of annoying.
Yes, there are third-party categories that give this functionality,
but it really should be part of the default API.
I've never understood this attitude. I must be missing something,
because to me it feels elitist.
What's the difference between calling FSFindFolder and, say, [NSFolder
folder:kApplicationSupportFolder]? One isn't inherently better than the
other, and there's no reason to think that AppKit is the best way to do
EVERYthing. AppKit is really, really good at most stuff, so we get used
to relying on it, but they haven't managed to get every Mac-related
idiosyncrasy wedged in there yet, so there are still some pretty
glaring gaps (like this one, or types and creators, or aliases, etc
etc). And honestly I don't think Apple is providing much extra value if
they spend all their time writing each API twice, once with brackets
and once without :) Sure, FSRef isn't a super-common type to be passing
around in Cocoa code, but you're one call away from turning that into a
path, and you can easily encapsulate the entire conversion of
FSRef->NSString within a tiny helper function.
NSString *FindFolderNS( .... )
{
FSRef myRef;
if( noErr != FSFindFolder( ... ) ) return NULL; // or maybe @"" ??
UInt8 path[PATH_MAX];
if( noErr != FSRefMakePath( ... ) ) return NULL;
return [NSString stringWithUTF8String:path];
}
Come on, that wasn't a big deal :) So I don't understand the
complaining we see on this list any time we can't use AppKit to do
something...
_______________________________________________
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