NSFileManager+Safety.h 1.58 KB
//
//  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