文件-沙盒目录代码段;
来源:互联网 发布:猜幻数游戏编程c语言 编辑:程序博客网 时间:2024/06/03 20:21
#pragma mark -把文件复制到沙盒目录;- (BOOL)copyFilePath:(NSString *)fromPath toPath:(NSString *)toPath{ NSFileManager *fileMan = [NSFileManager defaultManager]; NSError *error = nil; if ([fileMan fileExistsAtPath:toPath]) { debugLog(@"MDRootVC:The file %@ is exist!", toPath); return NO; } BOOL retCode = [fileMan copyItemAtPath:fromPath toPath:toPath error:&error]; return retCode;}
categoryArray = [NSMutableArray arrayWithCapacity:1]; NSString *docPth = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *toPth = [docPth stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist", DM_CATEGORY_ARR]]; /* NSString *path111 = [NSHomeDirectory() stringByAppendingPathComponent:@"Library"]; NSArray *paths1 = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *libraryDirectory = [paths1 objectAtIndex:0]; NSLog(@"app_home_lib: %@",libraryDirectory); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSLog(@"app_home_doc: %@",documentsDirectory); */ NSFileManager *fileMana = [NSFileManager defaultManager]; if ([fileMana fileExistsAtPath:toPth]) { debugLog(@"这个文件已经存在,不要再复制了,程序第一次启动时已经复制了"); categoryOriginArr = [[NSArray alloc] initWithContentsOfFile:toPth]; }else{ NSString *catPth = [[NSBundle mainBundle] pathForResource:DM_CATEGORY_ARR ofType:@"plist"]; categoryOriginArr = [NSArray arrayWithContentsOfFile:catPth]; [self copyFilePath:catPth toPath:toPth]; //这个函数里面已经有文件存在与否的判断; }
0 0
- 文件-沙盒目录代码段;
- 文件上传代码段
- exe文件包含数据段、代码段
- Android代码目录、文件分析
- LINUX下目标文件的BSS段、数据段、代码段
- LINUX下目标文件的BSS段、数据段、代码段
- iOS沙盒文件目录
- java删除文件目录、文件代码
- 代码段
- 代码段
- 代码段
- 代码段
- 代码段
- 代码段
- 代码段
- 代码段
- 代码段
- 代码段
- toast提示工具
- Sharepoint习题——待定
- Starling Feathers Controls ImageLoader
- lob类型的存放
- ConcurrentModificationException异常在Iterator移除节点上
- 文件-沙盒目录代码段;
- 运行locate无法找到mlocate.db的解决方法
- Eclipse快捷键 10个最有用的快捷键
- Netty3 源码分析 - ChannelPipeline
- 正式使用opencv里的训练和检测 - opencv_createsamples、opencv_traincascade-2.4.11版本
- maven使用技巧
- HDU 2066 一个人的旅行
- document.createElement()的用法
- 指针与字符串操作-一道腾讯笔试题