Re: Creating an Application Support folder
Re: Creating an Application Support folder
- Subject: Re: Creating an Application Support folder
- From: Ken Thomases <email@hidden>
- Date: Sat, 13 Feb 2010 07:58:04 -0600
On Feb 12, 2010, at 10:17 AM, Sean McBride wrote:
> On 2/10/10 10:44 PM, Paul Johnson said:
>
>> I'm trying to find a best way to create the Application Support
>> folder. I'm rather new at Cocoa so it's taking me a while to do even
>> this simple thing.
>
> Since you're new to Cocoa, I'm guessing all the other replies have
> probably provided the real answers you need.
>
> However, I just tried a little test. I renamed my App Support folder
> then did this:
>
> NSSearchPathForDirectoriesInDomains (
> NSApplicationSupportDirectory,
> NSUserDomainMask, YES);
>
> It just returned the path, but did not create the folder.
>
> This is in contrast to FSFindFolder() which can optionally (attempt to)
> create the folder for you.
>
> So although unlikely, be prepared for the folder to not exist.
If you're targeting Snow Leopard or later, the new recommended routines are:
-[NSFileManager URLForDirectory:inDomain:appropriateForURL:create:error:]
-[NSFileManager URLsForDirectory:inDomains:]
The former can be told to create the directory for you.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden