Commit 3b847efd477403c1fc5868152fccc7389b97589e
1 parent
99af3201
修改
Showing
1 changed file
with
17 additions
and
17 deletions
CNLiveBusinessTools/Classes/CNLiveBusinessTools.m
| ... | ... | @@ -853,7 +853,7 @@ |
| 853 | 853 | /// @param fileName 临时图片或视频名字 |
| 854 | 854 | + (NSString *)chatImageAndVideoUploadIMCachePath:(NSString *)fileName; |
| 855 | 855 | { |
| 856 | - NSString *temp = [CNLiveBusinessTools getChatImageAndVideoUploadIMCacheDirectory]; | |
| 856 | + NSString *filePath = [CNLiveBusinessTools getChatImageAndVideoUploadIMCacheDirectory]; | |
| 857 | 857 | filePath = [filePath stringByAppendingPathComponent:fileName]; |
| 858 | 858 | return filePath; |
| 859 | 859 | } |
| ... | ... | @@ -861,22 +861,22 @@ |
| 861 | 861 | + (NSString *)getChatImageAndVideoUploadIMCacheDirectory; |
| 862 | 862 | { |
| 863 | 863 | NSString *temp = [NSString stringWithFormat:@"Documents/%@/image_video_temp", CNUserShareModel.uid]; |
| 864 | - | |
| 865 | - NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent:temp]; | |
| 866 | - | |
| 867 | - NSFileManager *fileManager = [NSFileManager defaultManager]; | |
| 868 | - | |
| 869 | - BOOL isDir = NO; | |
| 870 | - | |
| 871 | - // fileExistsAtPath 判断一个文件或目录是否有效,isDirectory判断是否一个目录 | |
| 872 | - BOOL existed = [fileManager fileExistsAtPath:filePath isDirectory:&isDir]; | |
| 873 | - | |
| 874 | - if ( !(isDir == YES && existed == YES) ) { | |
| 875 | - | |
| 876 | - // 在 Documents 目录下创建一个 image_video_temp 目录 | |
| 877 | - [fileManager createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil]; | |
| 878 | - } | |
| 879 | - return filePath; | |
| 864 | + | |
| 865 | + NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent:temp]; | |
| 866 | + | |
| 867 | + NSFileManager *fileManager = [NSFileManager defaultManager]; | |
| 868 | + | |
| 869 | + BOOL isDir = NO; | |
| 870 | + | |
| 871 | + // fileExistsAtPath 判断一个文件或目录是否有效,isDirectory判断是否一个目录 | |
| 872 | + BOOL existed = [fileManager fileExistsAtPath:filePath isDirectory:&isDir]; | |
| 873 | + | |
| 874 | + if ( !(isDir == YES && existed == YES) ) { | |
| 875 | + | |
| 876 | + // 在 Documents 目录下创建一个 image_video_temp 目录 | |
| 877 | + [fileManager createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil]; | |
| 878 | + } | |
| 879 | + return filePath; | |
| 880 | 880 | } |
| 881 | 881 | /// 删除聊天 图片 和 视频 上传时的临时文件 |
| 882 | 882 | + (BOOL )deleteChatImageAndVideoUploadImCache | ... | ... |