码迷,mamicode.com
首页 > 其他好文 > 详细

检查本地是否存在某个文件

时间:2016-10-23 07:49:15      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:color   sse   exists   rdo   本地   local   pen   sts   code   

// 取得沙盒目录
NSString *localPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
// 要检查的文件目录
NSString *filePath = [localPath  stringByAppendingPathComponent:@"abc.doc"];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]) {
    NSLog(@"文件abc.doc存在");
}
else {
    NSLog(@"文件abc.doc不存在");
}

 

检查本地是否存在某个文件

标签:color   sse   exists   rdo   本地   local   pen   sts   code   

原文地址:http://www.cnblogs.com/pengyunjing/p/5988957.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!