方法1
1
2
3
4
5
6
|
+ ( BOOL )isDirectory:(NSString *)filePath { BOOL isDirectory = NO; [[NSFileManager defaultManager] fileExistsAtPath:filePath isDirectory:&isDirectory]; return isDirectory; } |
方法2
1
2
3
4
5
6
7
|
+ ( BOOL )isDirectory:(NSString *)filePath { NSNumber *isDirectory; NSURL *fileUrl = [NSURL fileURLWithPath:filePath]; [fileUrl getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil]; return isDirectory.boolValue; } |
如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
原文链接:http://blog.csdn.net/potato512/article/details/74167918