各种路径的获取方法
转http://blog.csdn.net/banyingli/article/details/6124995
根据文件名来获取文件路径(Document目录下)
- //根据文件名来获取文件路径
- - (NSString *)dataFilePath:(NSString *)sender {
- NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
- NSUserDomainMask,
- YES);
- NSString *documentDirectory = [path objectAtIndex:0];
- return [documentDirectory stringByAppendingPathComponent:sender];
- }
resource目录下
- NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:filename];
Cache目录下
- NSArray *cache = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
- NSString *cachePath = [cache objectAtIndex:0] ;
- NSString *voiceName = [cachePath stringByAppendingPathComponent:[sender stringByAppendingString:@".wav"]];
posted on 2012-07-25 22:33 kiao295338444 阅读(154) 评论(0) 编辑 收藏 举报