获取ios app资源路径

 

    //根据文件名来获取文件路径  doucument
- (NSString *)dataFilePath:(NSString *)sender {
NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask,
YES);
NSString *documentDirectory = [path objectAtIndex:0];
return [documentDirectory stringByAppendingPathComponent:sender];
}

 

NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:filename]; //资源目录

 

NSArray *cache = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);     //caches目录
NSString *cachePath = [cache objectAtIndex:0] ;

NSString *voiceName = [cachePath stringByAppendingPathComponent:[sender stringByAppendingString:@".wav"]];




posted @ 2011-12-26 13:46  痴人指路  阅读(770)  评论(0编辑  收藏  举报