NSFileManager+Safety.h
1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// NSFileManager+Safety.h
// BBAFoundation
//
// Created by Zhu,Yusong on 2018/9/25.
// Copyright © 2018年 Baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BDPFoundationDefines.h"
/*
* FileManager的安全相关的扩展
* 详细介绍请看README-SafeAPI
*/
NS_ASSUME_NONNULL_BEGIN
@interface NSFileManager (Safety)
/**
* @brief 安全拷贝文件
*
* @param srcPath 原文件路径
* @param dstPath 目标文件路径
* @param error error
* @return 是否操作成功
*/
- (BOOL)safe_copyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error BDP_FOUNDATION_DEPRECATED("please use bdp_safeCopyItemAtPath:toPath:error:");
- (BOOL)bdp_safeCopyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error;
/**
* @brief 安全移动文件
*
* @param srcPath 原文件路径
* @param dstPath 目标文件路径
* @param error error
* @return 是否操作成功
*/
- (BOOL)safe_moveItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error BDP_FOUNDATION_DEPRECATED("please use bdp_safeMoveItemAtPath:toPath:error:");
- (BOOL)bdp_safeMoveItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error;
/**
* @brief 安全删除文件
*
* @param path 文件路径
* @param error error
* @return 是否操作成功
*/
- (BOOL)safe_removeItemAtPath:(NSString *)path error:(NSError **)error BDP_FOUNDATION_DEPRECATED("please use bdp_safeRemoveItemAtPath:error:");
- (BOOL)bdp_safeRemoveItemAtPath:(NSString *)path error:(NSError **)error;
@end
NS_ASSUME_NONNULL_END