资源路径和自定义路径

NSString *jsonBasePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Album10.json"];

rootSavePath=[[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"] retain];
    dbSavePath=[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/iquyue.db"] retain];
    NSFileManager *fileManager = [NSFileManager defaultManager];
   
    BOOL fileExists = [fileManager fileExistsAtPath:rootSavePath];
   
    if (!fileExists) {
        [fileManager createDirectoryAtPath:rootSavePath withIntermediateDirectories:YES attributes:nil error:nil];
    }
   
    NSString *coverPath=[rootSavePath stringByAppendingPathComponent:@"cover"];
    fileExists = [fileManager fileExistsAtPath:coverPath];
   
    if (!fileExists) {
        [fileManager createDirectoryAtPath:coverPath withIntermediateDirectories:YES attributes:nil error:nil];
    }
   
    NSString *resourcePath=[rootSavePath stringByAppendingPathComponent:@"resource"];
    fileExists = [fileManager fileExistsAtPath:resourcePath];
   
    if (!fileExists) {
        [fileManager createDirectoryAtPath:resourcePath withIntermediateDirectories:YES attributes:nil error:nil];
    }
   
   
    NSURL *myURL=[[NSURL alloc] initWithString:rootSavePath];
    [self addSkipBackupAttributeToItemAtURL:myURL];
    [myURL release];
   
   
    NSURL *dbURL=[[NSURL alloc] initWithString:dbSavePath];
    [self addSkipBackupAttributeToItemAtURL:dbURL];
    [dbURL release];
   
    [self copyDatabaseIfNeeded];

你可能感兴趣的:(自定义)