NSString *getBundleName(){
NSDictionary *dir = [[NSBundle mainBundle] infoDictionary];
return [dir objectForKey:@"CFBundleName"];
}
int main(int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString *appSupportDirectory = [paths objectAtIndex:0];
appSupportDirectory = [appSupportDirectory stringByAppendingFormat:@"/%@", getBundleName()];
NSLog(@"path: %@", appSupportDirectory);
//NSLog(@"path: %@", paths);
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL flag = [fileManager fileExistsAtPath:appSupportDirectory];
if (!flag) {
flag = [fileManager createDirectoryAtPath:appSupportDirectory withIntermediateDirectories:YES attributes:nil error:nil];
if (!flag) {
appSupportDirectory = @"../Resourcest";
}
}
}
return 0;
}