From de43c48ea91a5d2ea3740e5bec2474daa2ebf5d7 Mon Sep 17 00:00:00 2001 From: "junzhan.yzw" Date: Mon, 2 Nov 2015 18:03:42 +0800 Subject: [PATCH] update the file modification time is a little time-consuming --- ZipArchive.h | 3 +++ ZipArchive.m | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ZipArchive.h b/ZipArchive.h index f5757f3..ab5efae 100644 --- a/ZipArchive.h +++ b/ZipArchive.h @@ -92,6 +92,9 @@ typedef void(^ZipArchiveProgressUpdateBlock)(int percentage, int filesProcessed, @property (nonatomic, assign) ZipArchiveCompression compression; +/** Do you need to update the file modification time? This operation is a little time-consuming.*/ +@property (nonatomic, assign) BOOL needUpdateFileModificationDate; + /** @brief String encoding to be used when interpreting file names in the zip file. */ diff --git a/ZipArchive.m b/ZipArchive.m index d7c1066..c012c72 100644 --- a/ZipArchive.m +++ b/ZipArchive.m @@ -51,6 +51,7 @@ -(id) initWithFileManager:(NSFileManager*) fileManager _fileManager = fileManager; self.stringEncoding = NSUTF8StringEncoding; self.compression = ZipArchiveCompressionDefault; + self.needUpdateFileModificationDate = YES; } return self; } @@ -385,7 +386,7 @@ -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite [(NSMutableArray*)_unzippedFiles addObject:fullPath]; // set the orignal datetime property - if( fileInfo.tmu_date.tm_year!=0 ) + if(self.needUpdateFileModificationDate && fileInfo.tmu_date.tm_year!=0 ) { NSDateComponents* components = [[NSDateComponents alloc] init]; components.second = fileInfo.tmu_date.tm_sec;