diff --git a/Zip.xcodeproj/project.pbxproj b/Zip.xcodeproj/project.pbxproj index b07ba88f0730fff3d016f950627a63a6a30774dd..163d7032b1eeada194ec9eb6840010f8a5e5dbd5 100644 --- a/Zip.xcodeproj/project.pbxproj +++ b/Zip.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 3430F5D61C45B7FB007473A6 /* ZipHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430F5D51C45B7FB007473A6 /* ZipHelpers.swift */; }; 347E3A781C1DFFB500A11FD3 /* Zip.h in Headers */ = {isa = PBXBuildFile; fileRef = 347E3A771C1DFFB500A11FD3 /* Zip.h */; settings = {ATTRIBUTES = (Public, ); }; }; 347E3A7F1C1DFFB500A11FD3 /* Zip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 347E3A741C1DFFB500A11FD3 /* Zip.framework */; }; 347E3A841C1DFFB500A11FD3 /* ZipTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347E3A831C1DFFB500A11FD3 /* ZipTests.swift */; }; @@ -26,6 +27,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 3430F5D51C45B7FB007473A6 /* ZipHelpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZipHelpers.swift; sourceTree = ""; }; 347E3A741C1DFFB500A11FD3 /* Zip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Zip.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 347E3A771C1DFFB500A11FD3 /* Zip.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Zip.h; sourceTree = ""; }; 347E3A791C1DFFB500A11FD3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -82,6 +84,7 @@ 347E3B1E1C1E1CB500A11FD3 /* libz.1.2.5.tbd */, 347E3A771C1DFFB500A11FD3 /* Zip.h */, 347E3A791C1DFFB500A11FD3 /* Info.plist */, + 3430F5D51C45B7FB007473A6 /* ZipHelpers.swift */, 347E3AD71C1E04C900A11FD3 /* Zip.swift */, ); path = Zip; @@ -206,6 +209,7 @@ buildActionMask = 2147483647; files = ( 347E3AD81C1E04C900A11FD3 /* Zip.swift in Sources */, + 3430F5D61C45B7FB007473A6 /* ZipHelpers.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Zip/Zip.swift b/Zip/Zip.swift index 43d6e83d3b9e6b5bfe0d77c2b53e6f3c45b25756..00ea3ad99601234b4bd0581f1420dd44d88b4a8b 100644 --- a/Zip/Zip.swift +++ b/Zip/Zip.swift @@ -119,132 +119,5 @@ public class Zip { currentPosition++ } - // crc_ret = unzCloseCurrentFile( zip ); - // if (crc_ret == UNZ_CRCERROR) { - // //CRC ERROR - // return NO; - // } - // ret = unzGoToNextFile( zip ); - // - // // Message delegate - // if ([delegate respondsToSelector:@selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { - // [delegate zipArchiveDidUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry - // archivePath:path fileInfo:fileInfo]; - // } else if ([delegate respondsToSelector: @selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:unzippedFilePath:)]) { - // [delegate zipArchiveDidUnzipFileAtIndex: currentFileNumber totalFiles: (NSInteger)globalInfo.number_entry - // archivePath:path unzippedFilePath: fullPath]; - // } - // - // currentFileNumber++; - // if (progressHandler) - // { - // progressHandler(strPath, fileInfo, currentFileNumber, globalInfo.number_entry); - // } - -// -// // Set the original datetime property -// if (fileInfo.dosDate != 0) { -// NSDate *orgDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate]; -// NSDictionary *attr = @{NSFileModificationDate: orgDate}; -// -// if (attr) { -// if ([fileManager setAttributes:attr ofItemAtPath:fullPath error:nil] == NO) { -// // Can't set attributes -// NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting modification date"); -// } -// } -// } -// -// // Set the original permissions on the file -// uLong permissions = fileInfo.external_fa >> 16; -// if (permissions != 0) { -// // Store it into a NSNumber -// NSNumber *permissionsValue = @(permissions); -// -// // Retrieve any existing attributes -// NSMutableDictionary *attrs = [[NSMutableDictionary alloc] initWithDictionary:[fileManager attributesOfItemAtPath:fullPath error:nil]]; -// -// // Set the value in the attributes dict -// attrs[NSFilePosixPermissions] = permissionsValue; -// -// // Update attributes -// if ([fileManager setAttributes:attrs ofItemAtPath:fullPath error:nil] == NO) { -// // Unable to set the permissions attribute -// NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting permissions"); -// } -// -// #if !__has_feature(objc_arc) -// [attrs release]; -// #endif -// } -// } -// } -// else -// { -// // Assemble the path for the symbolic link -// NSMutableString* destinationPath = [NSMutableString string]; -// int bytesRead = 0; -// while((bytesRead = unzReadCurrentFile(zip, buffer, 4096)) > 0) -// { -// buffer[bytesRead] = (int)0; -// [destinationPath appendString:@((const char*)buffer)]; -// } -// -// // Create the symbolic link (making sure it stays relative if it was relative before) -// int symlinkError = symlink([destinationPath cStringUsingEncoding:NSUTF8StringEncoding], -// [fullPath cStringUsingEncoding:NSUTF8StringEncoding]); -// -// if(symlinkError != 0) -// { -// NSLog(@"Failed to create symbolic link at \"%@\" to \"%@\". symlink() error code: %d", fullPath, destinationPath, errno); -// } -// } -// -// crc_ret = unzCloseCurrentFile( zip ); -// if (crc_ret == UNZ_CRCERROR) { -// //CRC ERROR -// return NO; -// } -// ret = unzGoToNextFile( zip ); -// -// // Message delegate -// if ([delegate respondsToSelector:@selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { -// [delegate zipArchiveDidUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry -// archivePath:path fileInfo:fileInfo]; -// } else if ([delegate respondsToSelector: @selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:unzippedFilePath:)]) { -// [delegate zipArchiveDidUnzipFileAtIndex: currentFileNumber totalFiles: (NSInteger)globalInfo.number_entry -// archivePath:path unzippedFilePath: fullPath]; -// } -// -// currentFileNumber++; -// if (progressHandler) -// { -// progressHandler(strPath, fileInfo, currentFileNumber, globalInfo.number_entry); -// } -// } -//} while(ret == UNZ_OK && ret != UNZ_END_OF_LIST_OF_FILE); -// -//// Close -//unzClose(zip); -// -//// The process of decompressing the .zip archive causes the modification times on the folders -//// to be set to the present time. So, when we are done, they need to be explicitly set. -//// set the modification date on all of the directories. -//NSError * err = nil; -//for (NSDictionary * d in directoriesModificationDates) { -// if (![[NSFileManager defaultManager] setAttributes:@{NSFileModificationDate: d[@"modDate"]} ofItemAtPath:d[@"path"] error:&err]) { -// NSLog(@"[SSZipArchive] Set attributes failed for directory: %@.", d[@"path"]); -// } -// if (err) { -// NSLog(@"[SSZipArchive] Error setting directory file modification date attribute: %@",err.localizedDescription); -// } -//} -// -//#if !__has_feature(objc_arc) -//[directoriesModificationDates release]; -//#endif -// -//// Message delegate -//} } \ No newline at end of file