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;