IOS判断文件是否可读 可写 可操作
NSString *standarPath = [[NSBundle mainBundle] pathForResource:@"ComPort" ofType:@"dat"];
NSFileManager *fileManager = [NSFileManager defaultManager];
//文件是否可写
if ([fileManager isWritableFileAtPath:standarPath]) {
NSLog(@"isWritable");
}
//文件是否可读
if ([fileManager isReadableFileAtPath:standarPath]) {
NSLog(@"isReadable");
}
//文件是否可执行
if ( [fileManager isExecutableFileAtPath:standarPath]){
NSLog(@"is Executable");
}
本文介绍了如何在iOS环境中使用Objective-C代码判断文件是否具备可读、可写、可执行的权限,并通过实例展示了实现过程。
890

被折叠的 条评论
为什么被折叠?



