#pragma mark -获取沙盒Document的文件目录
+ (NSString*)getDocumentDirectory{
return[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES)lastObject];
}
#pragma mark -获取沙盒Library的文件目录
+ (NSString*)getLibraryDirectory{
return[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask,YES)lastObject];
}
#pragma mark -获取沙盒Caches的文件目录
+ (NSString*)getCachesDirectory{
return[NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES)lastObject];
}
#pragma mark -获取沙盒Preference的文件目录
+ (NSString*)getPreferencePanesDirectory{
return[NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory,NSUserDomainMask,YES)lastObject];
}
#pragma mark -获取沙盒tmp的文件目录
+ (NSString*)getTmpDirectory{
returnNSTemporaryDirectory();
}
+ (BOOL)removeDocumentWithFilePath:(NSString*)filePath{
BOOLisRemove;
NSFileManager* fileManager=[NSFileManagerdefaultManager];
if([[NSFileManagerdefaultManager]fileExistsAtPath:filePath]) {
isRemove = [fileManagerremoveItemAtPath:filePatherror:nil];
}
returnisRemove;
}
网友评论