// // DRHistoryTool.m // YouHuiProject // // Created by 小花 on 2018/2/1. // Copyright © 2018年 kuxuan. All rights reserved. // #import "DRHistoryTool.h" @implementation DRHistoryTool + (NSString *)getHistoryFilePath { //1. 创建一个plist文件 NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString *path=[paths objectAtIndex:0]; // NSLog(@"path = %@",path); NSString *filename=[path stringByAppendingPathComponent:@"HistoryRecord.plist"]; NSFileManager* fm = [NSFileManager defaultManager]; if (![fm fileExistsAtPath:filename]) { [fm createFileAtPath:filename contents:nil attributes:nil]; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@[] forKey:@"historyArr"]; [dict writeToFile:filename atomically:YES]; } return filename; } + (NSString *)getJsonDataFilePath { //1. 创建一个plist文件 NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString *path=[paths objectAtIndex:0]; // NSLog(@"path = %@",path); NSString *filename=[path stringByAppendingPathComponent:@"JsonData.plist"]; NSFileManager* fm = [NSFileManager defaultManager]; if (![fm fileExistsAtPath:filename]) { [fm createFileAtPath:filename contents:nil attributes:nil]; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@[] forKey:@"JsonData"]; [dict writeToFile:filename atomically:YES]; } return filename; } @end