Support for splitting archive

This commit is contained in:
Jean-Baptiste
2017-11-22 07:31:33 +01:00
committed by GitHub
parent b6ba338a4c
commit bfc6fb8d34
+16 -1
View File
@@ -657,7 +657,7 @@ BOOL _fileIsSymbolicLink(const unz_file_info *fileInfo);
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(NSString *)password
{
SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path];
BOOL success = [zipArchive openWithSplitSize:0];
BOOL success = [zipArchive open];
if (success) {
for (NSString *filePath in paths) {
success &= [zipArchive writeFile:filePath withPassword:password];
@@ -689,6 +689,16 @@ BOOL _fileIsSymbolicLink(const unz_file_info *fileInfo);
return [self createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:keepParentDirectory compressionLevel:Z_DEFAULT_COMPRESSION password:password AES:YES diskSize:0 progressHandler:progressHandler];
}
+ (BOOL)createZipFileAtPath:(NSString *)path
withContentsOfDirectory:(NSString *)directoryPath
keepParentDirectory:(BOOL)keepParentDirectory
compressionLevel:(int)compressionLevel
password:(nullable NSString *)password
AES:(BOOL)aes
progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler {
return [self createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:keepParentDirectory compressionLevel:compressionLevel password:password AES:aes diskSize:0 progressHandler:progressHandler];
}
+ (BOOL)createZipFileAtPath:(NSString *)path
withContentsOfDirectory:(NSString *)directoryPath
keepParentDirectory:(BOOL)keepParentDirectory
@@ -749,6 +759,11 @@ BOOL _fileIsSymbolicLink(const unz_file_info *fileInfo);
return self;
}
- (BOOL)open
{
return [self openWithSplitSize:0];
}
- (BOOL)openWithSplitSize:(int)disk_size
{
NSAssert((_zip == NULL), @"Attempting to open an archive which is already open");