Created
May 23, 2012 00:30
-
-
Save indragiek/2772551 to your computer and use it in GitHub Desktop.
Application support folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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