Skip to content

Instantly share code, notes, and snippets.

@indragiek
Created May 23, 2012 00:30
Show Gist options
  • Save indragiek/2772551 to your computer and use it in GitHub Desktop.
Save indragiek/2772551 to your computer and use it in GitHub Desktop.
Application support folder
- (NSURL *)applicationSupportDirectory {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : NSTemporaryDirectory();
NSString *path = [basePath stringByAppendingPathComponent:@"YourAppName"];
NSFileManager *fm = [NSFileManager defaultManager];
if (![fm fileExistsAtPath:path isDirectory:NULL]) {
[fm createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
}
return [NSURL fileURLWithPath:path];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment