Hi Paul

Firstly, are you using the

NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, 
NSUserDomainMask, YES);

function to find the application support folder?

That would get you the base path, then you can use the 

stringByAppendingPathComponent:

method to add your folder name, then

BOOL isDirectory = NO;
BOOL exists = [[NSFileManager defaultManager] 
fileExistsAtPath:errorReporterPath isDirectory:&isDirectory];

and then check whether it exists, and whether it is a directory.

Then you can use methods like:

BOOL created = [[NSFileManager defaultManager] createDirectoryAtPath:path 
withIntermediateDirectories:YES attributes:nil error:&error];

to create the necessary folders. Hope this helps.


Gideon

On 11/02/2010, at 1:44 PM, Paul Johnson wrote:

> 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. I'm also interested in ensuring my application can
> be localized easily.
> 
> I have a function "- (NSString *)applicationSupportFolder" that
> returns the desired folder name, properly localized. I call this
> function and then use NSFileManager to check for the existence of the
> folder. Because there can be a file (NOT a folder) already bearing the
> folder name, I need to handle that possibility. Everything I've found
> on the internet just ignores this case.
> 
> Can anyone recommend what I should do?

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to