FROM : Charles Srstka
DATE : Tue Oct 12 18:21:36 2004
On Oct 11, 2004, at 7:40 PM, Sean McBride wrote:
> Steven Kramer (<email_removed>) on Sun, Oct 10, 2004 16:38
> said:
>
>>> I want to find the 'Application Support' folder from my app. What is
>>> the
>>> best way to do this? Any example code?
>>
>> NSFileManager* fileManager = [NSFileManager defaultManager];
>> NSMutableString* library = [[[NSSearchPathForDirectoriesInDomains
>> (NSLibraryDirectory, NSUserDomainMask, YES) anyObject] mutableCopy]
>> autorelease]; /// (where anyObject returns... any object!)
>> library = [[[library stringByAppendingPathComponent: @"Application
>> Support"] mutableCopy] autorelease];
>
> This is still hardcoding the string "Application Support". As others
> have said, using one of the FindFolder APIs is better.
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.
Charles
DATE : Tue Oct 12 18:21:36 2004
On Oct 11, 2004, at 7:40 PM, Sean McBride wrote:
> Steven Kramer (<email_removed>) on Sun, Oct 10, 2004 16:38
> said:
>
>>> I want to find the 'Application Support' folder from my app. What is
>>> the
>>> best way to do this? Any example code?
>>
>> NSFileManager* fileManager = [NSFileManager defaultManager];
>> NSMutableString* library = [[[NSSearchPathForDirectoriesInDomains
>> (NSLibraryDirectory, NSUserDomainMask, YES) anyObject] mutableCopy]
>> autorelease]; /// (where anyObject returns... any object!)
>> library = [[[library stringByAppendingPathComponent: @"Application
>> Support"] mutableCopy] autorelease];
>
> This is still hardcoding the string "Application Support". As others
> have said, using one of the FindFolder APIs is better.
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.
Charles
| Related mails | Author | Date |
|---|---|---|
| Peter Karlsson | Oct 9, 16:38 | |
| Sherm Pendley | Oct 9, 17:34 | |
| David Reed | Oct 9, 17:57 | |
| Finlay Dobbie | Oct 9, 18:11 | |
| Steven Kramer | Oct 10, 22:38 | |
| Sean McBride | Oct 12, 02:40 | |
| Charles Srstka | Oct 12, 18:21 | |
| John Stiles | Oct 12, 18:40 | |
| stephane sudre | Oct 12, 19:04 | |
| John Stiles | Oct 12, 19:36 | |
| Rosyna | Oct 12, 20:43 | |
| Greg Hurrell | Oct 18, 01:31 | |
| John Stiles | Oct 18, 18:03 |






Cocoa mail archive

