diff --git a/Example/AppDelegate.m b/Example/AppDelegate.m deleted file mode 100644 index 2be598e..0000000 --- a/Example/AppDelegate.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// AppDelegate.m -// Example -// -// Created by Douglas Bumby on 2015-07-11. -// Copyright (c) 2015 Cosmic Labs. All rights reserved. -// - -#import "AppDelegate.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - return YES; -} - -@end diff --git a/Example/Base.lproj/LaunchScreen.xib b/Example/Base.lproj/LaunchScreen.xib deleted file mode 100644 index 4e3aeb6..0000000 --- a/Example/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/ViewController.h b/Example/ViewController.h deleted file mode 100644 index 9b9de6d..0000000 --- a/Example/ViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ViewController.h -// Example -// -// Created by Douglas Bumby on 2015-07-11. -// Copyright (c) 2015 Cosmic Labs. All rights reserved. -// - -#import -#import - -@interface ViewController : UIViewController -@end - diff --git a/Example/ViewController.m b/Example/ViewController.m deleted file mode 100644 index 23c90d1..0000000 --- a/Example/ViewController.m +++ /dev/null @@ -1,40 +0,0 @@ -// -// ViewController.m -// Example -// -// Created by Douglas Bumby on 2015-07-11. -// Copyright (c) 2015 Cosmic Labs. All rights reserved. -// - -#import "ViewController.h" - -@interface ViewController () - -@end - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - - // Unzip Operation - NSString *zipPath = @"path_to_your_zip_file"; - NSString *destinationPath = @"path_to_the_folder_where_you_want_it_unzipped"; - - [Main unzipFileAtPath:zipPath - toDestination:destinationPath]; - - // Zip Operation - NSString *zippedPath = @"path_where_you_want_the_file_created"; - NSArray *inputPaths = @[[[NSBundle mainBundle] pathForResource:@"photo1" ofType:@"jpg"], - [[NSBundle mainBundle] pathForResource:@"photo1" ofType:@"jpg"]]; - - [Main createZipFileAtPath:zippedPath - withFilesAtPaths:inputPaths]; - - // Zip Directory - [Main createZipFileAtPath:zippedPath - withContentsOfDirectory:inputPaths]; -} - -@end \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt index 47552c7..2229be4 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2010-2015, ZipArchive, https://github.com/ZipArchive +Copyright (c) 2010-2015, Sam Soffes, http://soff.es Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/ObjectiveCExample/ObjectiveCExample.xcodeproj/project.pbxproj b/ObjectiveCExample/ObjectiveCExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..b57a52a --- /dev/null +++ b/ObjectiveCExample/ObjectiveCExample.xcodeproj/project.pbxproj @@ -0,0 +1,581 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8DFE19EF1BDA9FF300709011 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19EE1BDA9FF300709011 /* main.m */; }; + 8DFE19F21BDA9FF300709011 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19F11BDA9FF300709011 /* AppDelegate.m */; }; + 8DFE19F51BDA9FF300709011 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19F41BDA9FF300709011 /* ViewController.m */; }; + 8DFE19F81BDA9FF300709011 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19F61BDA9FF300709011 /* Main.storyboard */; }; + 8DFE19FA1BDA9FF300709011 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19F91BDA9FF300709011 /* Assets.xcassets */; }; + 8DFE19FD1BDA9FF300709011 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19FB1BDA9FF300709011 /* LaunchScreen.storyboard */; }; + 8DFE1A081BDA9FF300709011 /* SSZipArchiveTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */; }; + 8DFE1A141BDAA0A800709011 /* CollectingDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */; }; + 8DFE1A271BDAA10100709011 /* hello.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A161BDAA10100709011 /* hello.zip */; }; + 8DFE1A281BDAA10100709011 /* IncorrectHeaders.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A171BDAA10100709011 /* IncorrectHeaders.zip */; }; + 8DFE1A291BDAA10100709011 /* PermissionsTestApp.app in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A181BDAA10100709011 /* PermissionsTestApp.app */; }; + 8DFE1A2A1BDAA10100709011 /* RelativeSymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A191BDAA10100709011 /* RelativeSymbolicLink.zip */; }; + 8DFE1A2B1BDAA10100709011 /* SymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1A1BDAA10100709011 /* SymbolicLink.zip */; }; + 8DFE1A2C1BDAA10100709011 /* TestArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1B1BDAA10100709011 /* TestArchive.zip */; }; + 8DFE1A2D1BDAA10100709011 /* TestPasswordArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1C1BDAA10100709011 /* TestPasswordArchive.zip */; }; + 8DFE1A2E1BDAA10100709011 /* Unicode.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1D1BDAA10100709011 /* Unicode.zip */; }; + 8DFE1A2F1BDAA10100709011 /* 0.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1F1BDAA10100709011 /* 0.m4a */; }; + 8DFE1A301BDAA10100709011 /* 1.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A201BDAA10100709011 /* 1.m4a */; }; + 8DFE1A311BDAA10100709011 /* 2.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A211BDAA10100709011 /* 2.m4a */; }; + 8DFE1A321BDAA10100709011 /* 3.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A221BDAA10100709011 /* 3.m4a */; }; + 8DFE1A331BDAA10100709011 /* 4.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A231BDAA10100709011 /* 4.m4a */; }; + 8DFE1A341BDAA10100709011 /* 5.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A241BDAA10100709011 /* 5.m4a */; }; + 8DFE1A351BDAA10100709011 /* 6.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A251BDAA10100709011 /* 6.m4a */; }; + 8DFE1A361BDAA10100709011 /* 7.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A261BDAA10100709011 /* 7.m4a */; }; + BC14D61B16F6F9821E1D2AF8 /* Pods_ObjectiveCExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55A83C5BCB33C184EAB6A4E4 /* Pods_ObjectiveCExample.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 8DFE1A041BDA9FF300709011 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 8DFE19E21BDA9FF300709011 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DFE19E91BDA9FF300709011; + remoteInfo = ObjectiveCExample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1D19A4CE2C2507826BBF65B2 /* Pods-ObjectiveCExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectiveCExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample.debug.xcconfig"; sourceTree = ""; }; + 55A83C5BCB33C184EAB6A4E4 /* Pods_ObjectiveCExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ObjectiveCExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 8DFE19EA1BDA9FF300709011 /* ObjectiveCExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ObjectiveCExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 8DFE19EE1BDA9FF300709011 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 8DFE19F01BDA9FF300709011 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 8DFE19F11BDA9FF300709011 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 8DFE19F31BDA9FF300709011 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 8DFE19F41BDA9FF300709011 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 8DFE19F71BDA9FF300709011 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 8DFE19F91BDA9FF300709011 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 8DFE19FC1BDA9FF300709011 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 8DFE19FE1BDA9FF300709011 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObjectiveCExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSZipArchiveTests.m; sourceTree = ""; }; + 8DFE1A091BDA9FF300709011 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8DFE1A121BDAA0A800709011 /* CollectingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectingDelegate.h; sourceTree = ""; }; + 8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CollectingDelegate.m; sourceTree = ""; }; + 8DFE1A161BDAA10100709011 /* hello.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = hello.zip; sourceTree = ""; }; + 8DFE1A171BDAA10100709011 /* IncorrectHeaders.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = IncorrectHeaders.zip; sourceTree = ""; }; + 8DFE1A181BDAA10100709011 /* PermissionsTestApp.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = PermissionsTestApp.app; sourceTree = ""; }; + 8DFE1A191BDAA10100709011 /* RelativeSymbolicLink.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = RelativeSymbolicLink.zip; sourceTree = ""; }; + 8DFE1A1A1BDAA10100709011 /* SymbolicLink.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SymbolicLink.zip; sourceTree = ""; }; + 8DFE1A1B1BDAA10100709011 /* TestArchive.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = TestArchive.zip; sourceTree = ""; }; + 8DFE1A1C1BDAA10100709011 /* TestPasswordArchive.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = TestPasswordArchive.zip; sourceTree = ""; }; + 8DFE1A1D1BDAA10100709011 /* Unicode.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Unicode.zip; sourceTree = ""; }; + 8DFE1A1F1BDAA10100709011 /* 0.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 0.m4a; sourceTree = ""; }; + 8DFE1A201BDAA10100709011 /* 1.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 1.m4a; sourceTree = ""; }; + 8DFE1A211BDAA10100709011 /* 2.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 2.m4a; sourceTree = ""; }; + 8DFE1A221BDAA10100709011 /* 3.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 3.m4a; sourceTree = ""; }; + 8DFE1A231BDAA10100709011 /* 4.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 4.m4a; sourceTree = ""; }; + 8DFE1A241BDAA10100709011 /* 5.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 5.m4a; sourceTree = ""; }; + 8DFE1A251BDAA10100709011 /* 6.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 6.m4a; sourceTree = ""; }; + 8DFE1A261BDAA10100709011 /* 7.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 7.m4a; sourceTree = ""; }; + D8928CF7ED12679FE72CDF96 /* Pods-ObjectiveCExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectiveCExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DFE19E71BDA9FF300709011 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + BC14D61B16F6F9821E1D2AF8 /* Pods_ObjectiveCExample.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DFE1A001BDA9FF300709011 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 8DFE19E11BDA9FF300709011 = { + isa = PBXGroup; + children = ( + 8DFE19EC1BDA9FF300709011 /* ObjectiveCExample */, + 8DFE1A061BDA9FF300709011 /* ObjectiveCExampleTests */, + 8DFE19EB1BDA9FF300709011 /* Products */, + BCB342A5EC26DB692D25F7D4 /* Pods */, + 9DAA2CA8E954AC9481CC795C /* Frameworks */, + ); + sourceTree = ""; + }; + 8DFE19EB1BDA9FF300709011 /* Products */ = { + isa = PBXGroup; + children = ( + 8DFE19EA1BDA9FF300709011 /* ObjectiveCExample.app */, + 8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 8DFE19EC1BDA9FF300709011 /* ObjectiveCExample */ = { + isa = PBXGroup; + children = ( + 8DFE19F01BDA9FF300709011 /* AppDelegate.h */, + 8DFE19F11BDA9FF300709011 /* AppDelegate.m */, + 8DFE19F31BDA9FF300709011 /* ViewController.h */, + 8DFE19F41BDA9FF300709011 /* ViewController.m */, + 8DFE19F61BDA9FF300709011 /* Main.storyboard */, + 8DFE19F91BDA9FF300709011 /* Assets.xcassets */, + 8DFE19FB1BDA9FF300709011 /* LaunchScreen.storyboard */, + 8DFE19FE1BDA9FF300709011 /* Info.plist */, + 8DFE19ED1BDA9FF300709011 /* Supporting Files */, + ); + path = ObjectiveCExample; + sourceTree = ""; + }; + 8DFE19ED1BDA9FF300709011 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 8DFE19EE1BDA9FF300709011 /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 8DFE1A061BDA9FF300709011 /* ObjectiveCExampleTests */ = { + isa = PBXGroup; + children = ( + 8DFE1A151BDAA10100709011 /* Fixtures */, + 8DFE1A1E1BDAA10100709011 /* Multi_Zip_Test */, + 8DFE1A121BDAA0A800709011 /* CollectingDelegate.h */, + 8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */, + 8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */, + 8DFE1A091BDA9FF300709011 /* Info.plist */, + ); + path = ObjectiveCExampleTests; + sourceTree = ""; + }; + 8DFE1A151BDAA10100709011 /* Fixtures */ = { + isa = PBXGroup; + children = ( + 8DFE1A161BDAA10100709011 /* hello.zip */, + 8DFE1A171BDAA10100709011 /* IncorrectHeaders.zip */, + 8DFE1A181BDAA10100709011 /* PermissionsTestApp.app */, + 8DFE1A191BDAA10100709011 /* RelativeSymbolicLink.zip */, + 8DFE1A1A1BDAA10100709011 /* SymbolicLink.zip */, + 8DFE1A1B1BDAA10100709011 /* TestArchive.zip */, + 8DFE1A1C1BDAA10100709011 /* TestPasswordArchive.zip */, + 8DFE1A1D1BDAA10100709011 /* Unicode.zip */, + ); + path = Fixtures; + sourceTree = ""; + }; + 8DFE1A1E1BDAA10100709011 /* Multi_Zip_Test */ = { + isa = PBXGroup; + children = ( + 8DFE1A1F1BDAA10100709011 /* 0.m4a */, + 8DFE1A201BDAA10100709011 /* 1.m4a */, + 8DFE1A211BDAA10100709011 /* 2.m4a */, + 8DFE1A221BDAA10100709011 /* 3.m4a */, + 8DFE1A231BDAA10100709011 /* 4.m4a */, + 8DFE1A241BDAA10100709011 /* 5.m4a */, + 8DFE1A251BDAA10100709011 /* 6.m4a */, + 8DFE1A261BDAA10100709011 /* 7.m4a */, + ); + path = Multi_Zip_Test; + sourceTree = ""; + }; + 9DAA2CA8E954AC9481CC795C /* Frameworks */ = { + isa = PBXGroup; + children = ( + 55A83C5BCB33C184EAB6A4E4 /* Pods_ObjectiveCExample.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + BCB342A5EC26DB692D25F7D4 /* Pods */ = { + isa = PBXGroup; + children = ( + 1D19A4CE2C2507826BBF65B2 /* Pods-ObjectiveCExample.debug.xcconfig */, + D8928CF7ED12679FE72CDF96 /* Pods-ObjectiveCExample.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DFE19E91BDA9FF300709011 /* ObjectiveCExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8DFE1A0C1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExample" */; + buildPhases = ( + 9DD791BB0AF1B25DAC39CA6E /* Check Pods Manifest.lock */, + 8DFE19E61BDA9FF300709011 /* Sources */, + 8DFE19E71BDA9FF300709011 /* Frameworks */, + 8DFE19E81BDA9FF300709011 /* Resources */, + 46297D8971768D8719ECE6DF /* Embed Pods Frameworks */, + 2CFF892408F7E8BF9EC5C1C5 /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ObjectiveCExample; + productName = ObjectiveCExample; + productReference = 8DFE19EA1BDA9FF300709011 /* ObjectiveCExample.app */; + productType = "com.apple.product-type.application"; + }; + 8DFE1A021BDA9FF300709011 /* ObjectiveCExampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8DFE1A0F1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests" */; + buildPhases = ( + 8DFE19FF1BDA9FF300709011 /* Sources */, + 8DFE1A001BDA9FF300709011 /* Frameworks */, + 8DFE1A011BDA9FF300709011 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 8DFE1A051BDA9FF300709011 /* PBXTargetDependency */, + ); + name = ObjectiveCExampleTests; + productName = ObjectiveCExampleTests; + productReference = 8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 8DFE19E21BDA9FF300709011 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0710; + TargetAttributes = { + 8DFE19E91BDA9FF300709011 = { + CreatedOnToolsVersion = 7.1; + }; + 8DFE1A021BDA9FF300709011 = { + CreatedOnToolsVersion = 7.1; + TestTargetID = 8DFE19E91BDA9FF300709011; + }; + }; + }; + buildConfigurationList = 8DFE19E51BDA9FF300709011 /* Build configuration list for PBXProject "ObjectiveCExample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 8DFE19E11BDA9FF300709011; + productRefGroup = 8DFE19EB1BDA9FF300709011 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DFE19E91BDA9FF300709011 /* ObjectiveCExample */, + 8DFE1A021BDA9FF300709011 /* ObjectiveCExampleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8DFE19E81BDA9FF300709011 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DFE19FD1BDA9FF300709011 /* LaunchScreen.storyboard in Resources */, + 8DFE19FA1BDA9FF300709011 /* Assets.xcassets in Resources */, + 8DFE19F81BDA9FF300709011 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DFE1A011BDA9FF300709011 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DFE1A321BDAA10100709011 /* 3.m4a in Resources */, + 8DFE1A311BDAA10100709011 /* 2.m4a in Resources */, + 8DFE1A331BDAA10100709011 /* 4.m4a in Resources */, + 8DFE1A2F1BDAA10100709011 /* 0.m4a in Resources */, + 8DFE1A341BDAA10100709011 /* 5.m4a in Resources */, + 8DFE1A2D1BDAA10100709011 /* TestPasswordArchive.zip in Resources */, + 8DFE1A301BDAA10100709011 /* 1.m4a in Resources */, + 8DFE1A281BDAA10100709011 /* IncorrectHeaders.zip in Resources */, + 8DFE1A2A1BDAA10100709011 /* RelativeSymbolicLink.zip in Resources */, + 8DFE1A2E1BDAA10100709011 /* Unicode.zip in Resources */, + 8DFE1A2C1BDAA10100709011 /* TestArchive.zip in Resources */, + 8DFE1A271BDAA10100709011 /* hello.zip in Resources */, + 8DFE1A361BDAA10100709011 /* 7.m4a in Resources */, + 8DFE1A351BDAA10100709011 /* 6.m4a in Resources */, + 8DFE1A2B1BDAA10100709011 /* SymbolicLink.zip in Resources */, + 8DFE1A291BDAA10100709011 /* PermissionsTestApp.app in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 2CFF892408F7E8BF9EC5C1C5 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 46297D8971768D8719ECE6DF /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9DD791BB0AF1B25DAC39CA6E /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DFE19E61BDA9FF300709011 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DFE19F51BDA9FF300709011 /* ViewController.m in Sources */, + 8DFE19F21BDA9FF300709011 /* AppDelegate.m in Sources */, + 8DFE19EF1BDA9FF300709011 /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DFE19FF1BDA9FF300709011 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DFE1A141BDAA0A800709011 /* CollectingDelegate.m in Sources */, + 8DFE1A081BDA9FF300709011 /* SSZipArchiveTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 8DFE1A051BDA9FF300709011 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DFE19E91BDA9FF300709011 /* ObjectiveCExample */; + targetProxy = 8DFE1A041BDA9FF300709011 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 8DFE19F61BDA9FF300709011 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 8DFE19F71BDA9FF300709011 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 8DFE19FB1BDA9FF300709011 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 8DFE19FC1BDA9FF300709011 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 8DFE1A0A1BDA9FF300709011 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 8DFE1A0B1BDA9FF300709011 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 8DFE1A0D1BDA9FF300709011 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1D19A4CE2C2507826BBF65B2 /* Pods-ObjectiveCExample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = ObjectiveCExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 8DFE1A0E1BDA9FF300709011 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D8928CF7ED12679FE72CDF96 /* Pods-ObjectiveCExample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = ObjectiveCExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 8DFE1A101BDA9FF300709011 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObjectiveCExample.app/ObjectiveCExample"; + }; + name = Debug; + }; + 8DFE1A111BDA9FF300709011 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObjectiveCExample.app/ObjectiveCExample"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 8DFE19E51BDA9FF300709011 /* Build configuration list for PBXProject "ObjectiveCExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8DFE1A0A1BDA9FF300709011 /* Debug */, + 8DFE1A0B1BDA9FF300709011 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8DFE1A0C1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8DFE1A0D1BDA9FF300709011 /* Debug */, + 8DFE1A0E1BDA9FF300709011 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8DFE1A0F1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8DFE1A101BDA9FF300709011 /* Debug */, + 8DFE1A111BDA9FF300709011 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 8DFE19E21BDA9FF300709011 /* Project object */; +} diff --git a/ObjectiveCExample/ObjectiveCExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ObjectiveCExample/ObjectiveCExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..54c0346 --- /dev/null +++ b/ObjectiveCExample/ObjectiveCExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ObjectiveCExample/ObjectiveCExample.xcworkspace/contents.xcworkspacedata b/ObjectiveCExample/ObjectiveCExample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..7c612e7 --- /dev/null +++ b/ObjectiveCExample/ObjectiveCExample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Example/AppDelegate.h b/ObjectiveCExample/ObjectiveCExample/AppDelegate.h similarity index 60% rename from Example/AppDelegate.h rename to ObjectiveCExample/ObjectiveCExample/AppDelegate.h index 9523696..26d9c5a 100644 --- a/Example/AppDelegate.h +++ b/ObjectiveCExample/ObjectiveCExample/AppDelegate.h @@ -1,9 +1,9 @@ // // AppDelegate.h -// Example +// ObjectiveCExample +// +// Created by Sean Soper on 10/23/15. // -// Created by Douglas Bumby on 2015-07-11. -// Copyright (c) 2015 Cosmic Labs. All rights reserved. // #import @@ -12,5 +12,6 @@ @property (strong, nonatomic) UIWindow *window; + @end diff --git a/ObjectiveCExample/ObjectiveCExample/AppDelegate.m b/ObjectiveCExample/ObjectiveCExample/AppDelegate.m new file mode 100644 index 0000000..50b9e64 --- /dev/null +++ b/ObjectiveCExample/ObjectiveCExample/AppDelegate.m @@ -0,0 +1,45 @@ +// +// AppDelegate.m +// ObjectiveCExample +// +// Created by Sean Soper on 10/23/15. +// +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/Example/Images.xcassets/AppIcon.appiconset/Contents.json b/ObjectiveCExample/ObjectiveCExample/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 54% rename from Example/Images.xcassets/AppIcon.appiconset/Contents.json rename to ObjectiveCExample/ObjectiveCExample/Assets.xcassets/AppIcon.appiconset/Contents.json index 118c98f..36d2c80 100644 --- a/Example/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/ObjectiveCExample/ObjectiveCExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -29,6 +29,36 @@ "idiom" : "iphone", "size" : "60x60", "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" } ], "info" : { diff --git a/ObjectiveCExample/ObjectiveCExample/Base.lproj/LaunchScreen.storyboard b/ObjectiveCExample/ObjectiveCExample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..2e721e1 --- /dev/null +++ b/ObjectiveCExample/ObjectiveCExample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Base.lproj/Main.storyboard b/ObjectiveCExample/ObjectiveCExample/Base.lproj/Main.storyboard similarity index 83% rename from Example/Base.lproj/Main.storyboard rename to ObjectiveCExample/ObjectiveCExample/Base.lproj/Main.storyboard index d912f9d..f56d2f3 100644 --- a/Example/Base.lproj/Main.storyboard +++ b/ObjectiveCExample/ObjectiveCExample/Base.lproj/Main.storyboard @@ -1,24 +1,24 @@ - + - + - + - - + + - + - + - + diff --git a/Example/Info.plist b/ObjectiveCExample/ObjectiveCExample/Info.plist similarity index 77% rename from Example/Info.plist rename to ObjectiveCExample/ObjectiveCExample/Info.plist index a94796e..40c6215 100644 --- a/Example/Info.plist +++ b/ObjectiveCExample/ObjectiveCExample/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - io.cosmiclabs.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -36,5 +36,12 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + diff --git a/ObjectiveCExample/ObjectiveCExample/ViewController.h b/ObjectiveCExample/ObjectiveCExample/ViewController.h new file mode 100644 index 0000000..14c78e6 --- /dev/null +++ b/ObjectiveCExample/ObjectiveCExample/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// ObjectiveCExample +// +// Created by Sean Soper on 10/23/15. +// +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/ObjectiveCExample/ObjectiveCExample/ViewController.m b/ObjectiveCExample/ObjectiveCExample/ViewController.m new file mode 100644 index 0000000..e505480 --- /dev/null +++ b/ObjectiveCExample/ObjectiveCExample/ViewController.m @@ -0,0 +1,27 @@ +// +// ViewController.m +// ObjectiveCExample +// +// Created by Sean Soper on 10/23/15. +// +// + +#import "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/Example/main.m b/ObjectiveCExample/ObjectiveCExample/main.m similarity index 66% rename from Example/main.m rename to ObjectiveCExample/ObjectiveCExample/main.m index dcc6f87..741fd5f 100644 --- a/Example/main.m +++ b/ObjectiveCExample/ObjectiveCExample/main.m @@ -1,9 +1,9 @@ // // main.m -// Example +// ObjectiveCExample +// +// Created by Sean Soper on 10/23/15. // -// Created by Douglas Bumby on 2015-07-11. -// Copyright (c) 2015 Cosmic Labs. All rights reserved. // #import diff --git a/ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.h b/ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.h new file mode 100644 index 0000000..168ad78 --- /dev/null +++ b/ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.h @@ -0,0 +1,9 @@ +#import +#import + +/** + * Test delegate by collecting its calls + */ +@interface CollectingDelegate : NSObject +@property(nonatomic, retain) NSMutableArray *files; +@end \ No newline at end of file diff --git a/ZipArchiveTests/CollectingDelegate.m b/ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.m similarity index 56% rename from ZipArchiveTests/CollectingDelegate.m rename to ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.m index 99c8979..3d3f5c3 100644 --- a/ZipArchiveTests/CollectingDelegate.m +++ b/ObjectiveCExample/ObjectiveCExampleTests/CollectingDelegate.m @@ -1,27 +1,31 @@ // -// CollectingDelegate.m -// ZipArchive +// Created by chris on 8/1/12. // -// Originally Created by Chris on 2012-01-12. -// Copyright (c) 2015 ZipArchive. All rights reserved. +// To change the template use AppCode | Preferences | File Templates. // + #import "CollectingDelegate.h" -@implementation CollectingDelegate +@implementation CollectingDelegate { + +} @synthesize files = _files; + - (instancetype)init { self = [super init]; if (self) { self.files = [NSMutableArray array]; } - return self; } -- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destinationPath:(NSString *)destinationPath { +- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath { [self.files addObject:entryPath]; } + + + @end \ No newline at end of file diff --git a/ZipArchiveTests/Fixtures/IncorrectHeaders.zip b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/IncorrectHeaders.zip similarity index 100% rename from ZipArchiveTests/Fixtures/IncorrectHeaders.zip rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/IncorrectHeaders.zip diff --git a/ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/Info.plist b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Info.plist similarity index 100% rename from ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/Info.plist rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Info.plist diff --git a/ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/MacOS/TestProject b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/MacOS/TestProject similarity index 100% rename from ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/MacOS/TestProject rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/MacOS/TestProject diff --git a/ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/PkgInfo b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/PkgInfo similarity index 100% rename from ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/PkgInfo rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/PkgInfo diff --git a/ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/Resources/Assets.car b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/Assets.car similarity index 100% rename from ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/Resources/Assets.car rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/Assets.car diff --git a/ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/Resources/Base.lproj/MainMenu.nib b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/Base.lproj/MainMenu.nib similarity index 100% rename from ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/Resources/Base.lproj/MainMenu.nib rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/Base.lproj/MainMenu.nib diff --git a/ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/Resources/en.lproj/Credits.rtf b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/en.lproj/Credits.rtf similarity index 100% rename from ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/Resources/en.lproj/Credits.rtf rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/en.lproj/Credits.rtf diff --git a/ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/Resources/en.lproj/InfoPlist.strings b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/en.lproj/InfoPlist.strings similarity index 100% rename from ZipArchiveTests/Fixtures/PermissionsTestApp.app/Contents/Resources/en.lproj/InfoPlist.strings rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/PermissionsTestApp.app/Contents/Resources/en.lproj/InfoPlist.strings diff --git a/ZipArchiveTests/Fixtures/RelativeSymbolicLink.zip b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/RelativeSymbolicLink.zip similarity index 100% rename from ZipArchiveTests/Fixtures/RelativeSymbolicLink.zip rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/RelativeSymbolicLink.zip diff --git a/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/SymbolicLink.zip b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/SymbolicLink.zip new file mode 100644 index 0000000..dacc17b Binary files /dev/null and b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/SymbolicLink.zip differ diff --git a/ZipArchiveTests/Fixtures/TestArchive.zip b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/TestArchive.zip similarity index 100% rename from ZipArchiveTests/Fixtures/TestArchive.zip rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/TestArchive.zip diff --git a/ZipArchiveTests/Fixtures/TestPasswordArchive.zip b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/TestPasswordArchive.zip similarity index 100% rename from ZipArchiveTests/Fixtures/TestPasswordArchive.zip rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/TestPasswordArchive.zip diff --git a/ZipArchiveTests/Fixtures/Unicode.zip b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/Unicode.zip similarity index 100% rename from ZipArchiveTests/Fixtures/Unicode.zip rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/Unicode.zip diff --git a/ZipArchiveTests/Fixtures/hello.zip b/ObjectiveCExample/ObjectiveCExampleTests/Fixtures/hello.zip similarity index 100% rename from ZipArchiveTests/Fixtures/hello.zip rename to ObjectiveCExample/ObjectiveCExampleTests/Fixtures/hello.zip diff --git a/ZipArchiveTests/Info.plist b/ObjectiveCExample/ObjectiveCExampleTests/Info.plist similarity index 91% rename from ZipArchiveTests/Info.plist rename to ObjectiveCExample/ObjectiveCExampleTests/Info.plist index 157fb12..ba72822 100644 --- a/ZipArchiveTests/Info.plist +++ b/ObjectiveCExample/ObjectiveCExampleTests/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - io.cosmiclabs.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/ZipArchiveTests/Multi_Zip_Test/0.m4a b/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/0.m4a similarity index 100% rename from ZipArchiveTests/Multi_Zip_Test/0.m4a rename to ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/0.m4a diff --git a/ZipArchiveTests/Multi_Zip_Test/1.m4a b/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/1.m4a similarity index 100% rename from ZipArchiveTests/Multi_Zip_Test/1.m4a rename to ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/1.m4a diff --git a/ZipArchiveTests/Multi_Zip_Test/2.m4a b/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/2.m4a similarity index 100% rename from ZipArchiveTests/Multi_Zip_Test/2.m4a rename to ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/2.m4a diff --git a/ZipArchiveTests/Multi_Zip_Test/3.m4a b/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/3.m4a similarity index 100% rename from ZipArchiveTests/Multi_Zip_Test/3.m4a rename to ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/3.m4a diff --git a/ZipArchiveTests/Multi_Zip_Test/4.m4a b/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/4.m4a similarity index 100% rename from ZipArchiveTests/Multi_Zip_Test/4.m4a rename to ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/4.m4a diff --git a/ZipArchiveTests/Multi_Zip_Test/5.m4a b/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/5.m4a similarity index 100% rename from ZipArchiveTests/Multi_Zip_Test/5.m4a rename to ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/5.m4a diff --git a/ZipArchiveTests/Multi_Zip_Test/6.m4a b/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/6.m4a similarity index 100% rename from ZipArchiveTests/Multi_Zip_Test/6.m4a rename to ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/6.m4a diff --git a/ZipArchiveTests/Multi_Zip_Test/7.m4a b/ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/7.m4a similarity index 100% rename from ZipArchiveTests/Multi_Zip_Test/7.m4a rename to ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/7.m4a diff --git a/ObjectiveCExample/ObjectiveCExampleTests/SSZipArchiveTests.m b/ObjectiveCExample/ObjectiveCExampleTests/SSZipArchiveTests.m new file mode 100644 index 0000000..97fb9b8 --- /dev/null +++ b/ObjectiveCExample/ObjectiveCExampleTests/SSZipArchiveTests.m @@ -0,0 +1,414 @@ +// +// SSZipArchiveTests.m +// SSZipArchiveTests +// +// Created by Sam Soffes on 10/3/11. +// Copyright (c) 2011-2014 Sam Soffes. All rights reserved. +// + +#import +#import +#import + +#import "CollectingDelegate.h" + +@interface CancelDelegate : NSObject +@property (nonatomic, assign) int numFilesUnzipped; +@property (nonatomic, assign) int numFilesToUnzip; +@property (nonatomic, assign) BOOL didUnzipArchive; +@property (nonatomic, assign) int loaded; +@property (nonatomic, assign) int total; +@end + +@implementation CancelDelegate +- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo +{ + _numFilesUnzipped = fileIndex + 1; +} +- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo +{ + //return YES; + return _numFilesUnzipped < _numFilesToUnzip; +} +- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath +{ + _didUnzipArchive = YES; +} +- (void)zipArchiveProgressEvent:(NSInteger)loaded total:(NSInteger)total +{ + _loaded = (int)loaded; + _total = (int)total; +} +@end + +@interface SSZipArchiveTests : XCTestCase +@end + +@implementation SSZipArchiveTests { + NSMutableArray *progressEvents; +} + +- (void)setUp { + [super setUp]; + progressEvents = [NSMutableArray array]; +} + +- (void)tearDown { + [super tearDown]; + [[NSFileManager defaultManager] removeItemAtPath:[self _cachesPath:nil] error:nil]; +} + + +- (void)testZipping { + // use extracted files from [-testUnzipping] + NSString *inputPath = [self _cachesPath:@"Regular"]; + NSArray *inputPaths = @[[inputPath stringByAppendingPathComponent:@"Readme.markdown"], + [inputPath stringByAppendingPathComponent:@"LICENSE"]]; + + NSString *outputPath = [self _cachesPath:@"Zipped"]; + + NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedArchive.zip"]; + [SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths]; + + // TODO: Make sure the files are actually unzipped. They are, but the test should be better. + XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Archive created"); +} + + +- (void)testDirectoryZipping { + // use Unicode as folder (has a file in root and a file in subfolder) + NSString *inputPath = [self _cachesPath:@"Unicode"]; + + NSString *outputPath = [self _cachesPath:@"FolderZipped"]; + NSString *archivePath = [outputPath stringByAppendingPathComponent:@"ArchiveWithFolders.zip"]; + + [SSZipArchive createZipFileAtPath:archivePath withContentsOfDirectory:inputPath]; + XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Folder Archive created"); +} + +- (void)testMultipleZippping{ + NSArray *inputPaths = @[[[NSBundle bundleForClass: [self class]]pathForResource:@"0" ofType:@"m4a"], + + [[NSBundle bundleForClass: [self class]]pathForResource:@"1" ofType:@"m4a"], + [[NSBundle bundleForClass: [self class]]pathForResource:@"2" ofType:@"m4a"], + [[NSBundle bundleForClass: [self class]]pathForResource:@"3" ofType:@"m4a"], + [[NSBundle bundleForClass: [self class]]pathForResource:@"4" ofType:@"m4a"], + [[NSBundle bundleForClass: [self class]]pathForResource:@"5" ofType:@"m4a"], + [[NSBundle bundleForClass: [self class]]pathForResource:@"6" ofType:@"m4a"], + [[NSBundle bundleForClass: [self class]]pathForResource:@"7" ofType:@"m4a"] + ]; + NSString *outputPath = [self _cachesPath:@"Zipped"]; + + // this is a monster + // if testing on iOS, within 30 loops it will fail; however, on OS X, it may take about 900 loops + for (int test = 0; test < 20; test++) + { + // Zipping + NSString *archivePath = [outputPath stringByAppendingPathComponent:[NSString stringWithFormat:@"queue_test_%d.zip",test]]; + + [SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths]; + + long long threshold = 510000; // 510kB:size slightly smaller than a successful zip, but much larger than a failed one + long long fileSize = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:nil][NSFileSize] longLongValue]; + XCTAssertTrue(fileSize > threshold, @"zipping failed at %@!",archivePath); + } + +} + +- (void)testUnzipping { + NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"]; + NSString *outputPath = [self _cachesPath:@"Regular"]; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self]; + + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"]; + XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped"); + + testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"]; + XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped"); +} +- (void)testSmallFileUnzipping { + NSString *zipPath = [[NSBundle bundleForClass: [self class]] pathForResource:@"TestArchive" ofType:@"zip"]; + NSString *outputPath = [self _cachesPath:@"Regular"]; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self]; + + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"]; + XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped"); + + testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"]; + XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped"); +} +- (void)testUnzippingProgress { + NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"]; + NSString *outputPath = [self _cachesPath:@"Progress"]; + + [progressEvents removeAllObjects]; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self]; + + // 4 events: the first, then for each of the two files one, then the final event + XCTAssertTrue(4 == [progressEvents count], @"Expected 4 progress events"); + XCTAssertTrue(0 == [progressEvents[0] intValue]); + XCTAssertTrue(619 == [progressEvents[1] intValue]); + XCTAssertTrue(1114 == [progressEvents[2] intValue]); + XCTAssertTrue(1436 == [progressEvents[3] intValue]); +} + + +- (void)testUnzippingWithPassword { + NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestPasswordArchive" ofType:@"zip"]; + NSString *outputPath = [self _cachesPath:@"Password"]; + + NSError *error = nil; + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd" error:&error delegate:self]; + + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"]; + XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped"); + + testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"]; + XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped"); +} + + +- (void)testUnzippingTruncatedFileFix { + NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"IncorrectHeaders" ofType:@"zip"]; + NSString* outputPath = [self _cachesPath:@"IncorrectHeaders"]; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self]; + + NSString* intendedReadmeTxtMD5 = @"31ac96301302eb388070c827447290b5"; + + NSString* filePath = [outputPath stringByAppendingPathComponent:@"IncorrectHeaders/Readme.txt"]; + NSData* data = [NSData dataWithContentsOfFile:filePath]; + + NSString* actualReadmeTxtMD5 = [self _calculateMD5Digest:data]; + XCTAssertTrue([actualReadmeTxtMD5 isEqualToString:intendedReadmeTxtMD5], @"Readme.txt MD5 digest should match original."); +} + + +- (void)testUnzippingWithSymlinkedFileInside { + + NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"SymbolicLink" ofType:@"zip"]; + NSString* outputPath = [self _cachesPath:@"SymbolicLink"]; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self]; + + NSString *testSymlink = [outputPath stringByAppendingPathComponent:@"SymbolicLink/Xcode.app"]; + + NSError *error = nil; + NSDictionary *info = [[NSFileManager defaultManager] attributesOfItemAtPath: testSymlink error: &error]; + + XCTAssertTrue(info, @"Symbolic links should persist from the original archive to the outputted files."); +} + +- (void)testUnzippingWithRelativeSymlink { + + NSString *resourceName = @"RelativeSymbolicLink"; + NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:resourceName ofType:@"zip"]; + NSString* outputPath = [self _cachesPath:resourceName]; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self]; + + // Determine where the symlinks are + NSString *subfolderName = @"symlinks"; + NSString *testBasePath = [NSString pathWithComponents:@[outputPath]]; + NSString *testSymlinkFolder = [NSString pathWithComponents:@[testBasePath, subfolderName, @"folderSymlink"]]; + NSString *testSymlinkFile = [NSString pathWithComponents:@[testBasePath, subfolderName, @"fileSymlink"]]; + + BOOL found = [[NSFileManager defaultManager] attributesOfItemAtPath: testSymlinkFile error: nil]; + + XCTAssertTrue(found, @"Relative symbolic links should persist from the original archive to the outputted files (and also remain relative)."); + + found = [[NSFileManager defaultManager] attributesOfItemAtPath: testSymlinkFolder error: nil]; + + XCTAssertTrue(found, @"Relative symbolic links should persist from the original archive to the outputted files (and also remain relative)."); +} + +- (void)testUnzippingWithUnicodeFilenameInside { + + NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"Unicode" ofType:@"zip"]; + NSString* outputPath = [self _cachesPath:@"Unicode"]; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self]; + + bool unicodeFilenameWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Accént.txt"]]; + + bool unicodeFolderWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Fólder/Nothing.txt"]]; + + XCTAssertTrue(unicodeFilenameWasExtracted, @"Files with filenames in unicode should be extracted properly."); + XCTAssertTrue(unicodeFolderWasExtracted, @"Folders with names in unicode should be extracted propertly."); +} + + +- (void)testZippingAndUnzippingForDate { + + NSString *inputPath = [self _cachesPath:@"Regular"]; + NSArray *inputPaths = @[[inputPath stringByAppendingPathComponent:@"Readme.markdown"]]; + + NSDictionary *originalFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[inputPath stringByAppendingPathComponent:@"Readme.markdown"] error:nil]; + + NSString *outputPath = [self _cachesPath:@"ZippedDate"]; + NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedArchive.zip"]; + + [SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths]; + [SSZipArchive unzipFileAtPath:archivePath toDestination:outputPath delegate:self]; + + NSDictionary *createdFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[outputPath stringByAppendingPathComponent:@"Readme.markdown"] error:nil]; + + XCTAssertEqualObjects(originalFileAttributes[NSFileCreationDate], createdFileAttributes[@"NSFileCreationDate"], @"Orginal file creationDate should match created one"); +} + + +- (void)testZippingAndUnzippingForPermissions { + // File we're going to test permissions on before and after zipping + NSString *targetFile = @"/Contents/MacOS/TestProject"; + + + /********** Zipping ********/ + + // The .app file we're going to zip up + NSString *inputFile = [[NSBundle bundleForClass: [self class]] pathForResource:@"PermissionsTestApp" ofType:@"app"]; + + // The path to the target file in the app before zipping + NSString *targetFilePreZipPath = [inputFile stringByAppendingPathComponent:targetFile]; + + // Atribtues for the target file before zipping + NSDictionary *preZipAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:targetFilePreZipPath error:nil]; + + // Directory to output our created zip file + NSString *outputDir = [self _cachesPath:@"PermissionsTest"]; + // The path to where the archive shall be created + NSString *archivePath = [outputDir stringByAppendingPathComponent:@"TestAppArchive.zip"]; + + // Create the zip file using the contents of the .app file as the input + [SSZipArchive createZipFileAtPath:archivePath withContentsOfDirectory:inputFile]; + + + /********** Un-zipping *******/ + + // Using this newly created zip file, unzip it + [SSZipArchive unzipFileAtPath:archivePath toDestination:outputDir]; + + // Get the path to the target file after unzipping + NSString *targetFilePath = [outputDir stringByAppendingPathComponent:@"/Contents/MacOS/TestProject"]; + + // Get the file attributes of the target file following the unzipping + NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:targetFilePath error:nil]; + + // Compare the value of the permissions attribute to assert equality + XCTAssertEqual(fileAttributes[NSFilePosixPermissions], preZipAttributes[NSFilePosixPermissions], @"File permissions should be retained during compression and de-compression"); +} + +- (void)testUnzippingWithCancel { + NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"]; + NSString *outputPath = [self _cachesPath:@"Cancel1"]; + + CancelDelegate *delegate = [[CancelDelegate alloc] init]; + delegate.numFilesToUnzip = 1; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate]; + + XCTAssertEqual(delegate.numFilesUnzipped, 1); + XCTAssertFalse(delegate.didUnzipArchive); + XCTAssertNotEqual(delegate.loaded, delegate.total); + + outputPath = [self _cachesPath:@"Cancel2"]; + + delegate = [[CancelDelegate alloc] init]; + delegate.numFilesToUnzip = 1000; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate]; + + XCTAssertEqual(delegate.numFilesUnzipped, 2); + XCTAssertTrue(delegate.didUnzipArchive); + XCTAssertEqual(delegate.loaded, delegate.total); + +} + +// Commented out to avoid checking in several gig file into the repository. Simply add a file named +// `LargeArchive.zip` to the project and uncomment out these lines to test. +// +//- (void)testUnzippingLargeFiles { +// NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"LargeArchive" ofType:@"zip"]; +// NSString *outputPath = [self _cachesPath:@"Large"]; +// +// [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath]; +//} + +-(void)testShouldProvidePathOfUnzippedFileInDelegateCallback { + CollectingDelegate *collector = [CollectingDelegate new]; + NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"]; + NSString *outputPath = [self _cachesPath:@"Regular"]; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:collector]; + + // STAssertEqualObjects([collector.files objectAtIndex:0], @"LICENSE.txt", nil); + // STAssertEqualObjects([collector.files objectAtIndex:1], @"README.md", nil); +} + +#pragma mark - SSZipArchiveDelegate + +- (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo { + NSLog(@"*** zipArchiveWillUnzipArchiveAtPath: `%@` zipInfo:", path); +} + + +- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath { + NSLog(@"*** zipArchiveDidUnzipArchiveAtPath: `%@` zipInfo: unzippedPath: `%@`", path, unzippedPath); +} + +- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo +{ + NSLog(@"*** zipArchiveShouldUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath); + return YES; +} + +- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo { + NSLog(@"*** zipArchiveWillUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath); +} + + +- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo { + NSLog(@"*** zipArchiveDidUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath); +} + +- (void)zipArchiveProgressEvent:(NSInteger)loaded total:(NSInteger)total { + NSLog(@"*** zipArchiveProgressEvent: loaded: `%d` total: `%d`", (int)loaded, (int)total); + [progressEvents addObject:@(loaded)]; +} + + +#pragma mark - Private + +- (NSString *)_cachesPath:(NSString *)directory { + NSString *path = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] + stringByAppendingPathComponent:@"com.samsoffes.ssziparchive.tests"]; + if (directory) { + path = [path stringByAppendingPathComponent:directory]; + } + + NSFileManager *fileManager = [NSFileManager defaultManager]; + if (![fileManager fileExistsAtPath:path]) { + [fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil]; + } + + return path; +} + + +// Taken from https://github.com/samsoffes/sstoolkit/blob/master/SSToolkit/NSData+SSToolkitAdditions.m +- (NSString *)_calculateMD5Digest:(NSData *)data { + unsigned char digest[CC_MD5_DIGEST_LENGTH], i; + CC_MD5(data.bytes, (unsigned int)data.length, digest); + NSMutableString *ms = [NSMutableString string]; + for (i = 0; i < CC_MD5_DIGEST_LENGTH; i++) { + [ms appendFormat: @"%02x", (int)(digest[i])]; + } + return [ms copy]; +} + +@end diff --git a/ObjectiveCExample/Podfile b/ObjectiveCExample/Podfile new file mode 100644 index 0000000..d61a46a --- /dev/null +++ b/ObjectiveCExample/Podfile @@ -0,0 +1,8 @@ +source 'https://github.com/CocoaPods/Specs.git' + +# inhibit_all_warnings! +use_frameworks! + +target 'ObjectiveCExample' do + pod 'SSZipArchive', :path => '..' +end diff --git a/ObjectiveCExample/Podfile.lock b/ObjectiveCExample/Podfile.lock new file mode 100644 index 0000000..e2c38d1 --- /dev/null +++ b/ObjectiveCExample/Podfile.lock @@ -0,0 +1,14 @@ +PODS: + - SSZipArchive (0.3.2) + +DEPENDENCIES: + - SSZipArchive (from `..`) + +EXTERNAL SOURCES: + SSZipArchive: + :path: ".." + +SPEC CHECKSUMS: + SSZipArchive: 0f61dba1ab479a636f095aaf75a6cdafb5ff9d0c + +COCOAPODS: 0.39.0 diff --git a/README.md b/README.md index 4c1b1b4..a306b6b 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,53 @@ -#ZipArchive -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![License](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat -)](http://mit-license.org) +# SSZipArchive ZipArchive is a simple utility class for zipping and unzipping files on iOS and Mac. -##Installation and Setup -####Carthage -Carthage builds the dependencies and provides a binary framework for ZipArchive. To add ZipArchive to your project using Carthage, create a Cartfile and add: +- Unzip zip files; +- Unzip password protected zip files; +- Create new zip files; +- Append to existing zip files; +- Zip files; +- Zip-up NSData instances. (with a filename) -```ogdl -github "ZipArchive/ZipArchive" "master" -``` +## Installation and Setup -####CocoaPods -*currently not working. +### CocoaPods -####Manual -1. Add `Main.h` and `Main.m` to your project. -2. Add the `minizip` folder to your project. -3. Add the `libz` library to your target +`pod install SSZipArchive` + +### Manual + +1. Add the `SSZipArchive` and `minizip` folders to your project. +2. Add the `libz` library to your target + +SSZipArchive requires ARC. + +## Usage + +### Objective-C -##Usage ```objective-c -// Unzip Operation -NSString *zipPath = @"path_to_your_zip_file"; -NSString *destinationPath = @"path_to_the_folder_where_you_want_it_unzipped"; - -[Main unzipFileAtPath:zipPath - toDestination:destinationPath]; - -// Zip Operation -NSString *zippedPath = @"path_where_you_want_the_file_created"; -NSArray *inputPaths = @[[[NSBundle mainBundle] pathForResource:@"photo1" ofType:@"jpg"], - [[NSBundle mainBundle] pathForResource:@"photo1" ofType:@"jpg"]]; - -[Main createZipFileAtPath:zippedPath - withFilesAtPaths:inputPaths]; - -// Zip Directory -[Main createZipFileAtPath:zippedPath - withContentsOfDirectory:inputPaths]; +// Create +[SSZipArchive createZipFileAtPath: zipPath withContentsOfDirectory: sampleDataPath]; + +// Unzip +[SSZipArchive unzipFileAtPath:zipPath toDestination: unzipPath]; ``` -###Licensing -ZipArchive is released under the [MIT license](https://github.com/ZipArchive/ZipArchive/raw/master/LICENSE) and our slightly modified version of [Minizip](http://www.winimage.com/zLibDll/minizip.html) 1.1 is licensed under the [Zlib license](http://www.zlib.net/zlib_license.html). +### Swift + +```swift +// Create +SSZipArchive.createZipFileAtPath(zipPath, withContentsOfDirectory: sampleDataPath) + +// Unzip +SSZipArchive.unzipFileAtPath(zipPath, toDestination: unzipPath) +``` + +## License + +SSZipArchive is protected under the [MIT license](https://github.com/samsoffes/ssziparchive/raw/master/LICENSE) and our slightly modified version of [Minizip](http://www.winimage.com/zLibDll/minizip.html) 1.1 is licensed under the [Zlib license](http://www.zlib.net/zlib_license.html). + +## Acknowledgments + +Big thanks to [aish](http://code.google.com/p/ziparchive) for creating [ZipArchive](http://code.google.com/p/ziparchive). The project that inspired SSZipArchive. Thank you [@randomsequence](https://github.com/randomsequence) for implementing the creation support tech and to [@johnezang](https://github.com/johnezang) for all his amazing help along the way. diff --git a/SSZipArchive.podspec b/SSZipArchive.podspec index ad92720..ae2ca25 100644 --- a/SSZipArchive.podspec +++ b/SSZipArchive.podspec @@ -1,15 +1,16 @@ Pod::Spec.new do |s| s.name = 'SSZipArchive' - s.version = '0.3.3' + s.version = '0.4.0' s.summary = 'Utility class for zipping and unzipping files on iOS and Mac.' - s.description = 'ZipArchive is a simple utility class for zipping and unzipping files on iOS and Mac.' - s.homepage = 'https://github.com/ZipArchive/ZipArchive' + s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS and Mac.' + s.homepage = 'https://github.com/soffes/ssziparchive' s.license = { :type => 'MIT', :file => 'LICENSE.txt' } s.author = { 'Sam Soffes' => 'sam@soff.es' } - s.source = { :git => 'https://github.com/ZipArchive/ZipArchive.git', :tag => "v#{s.version}" } + s.source = { :git => 'https://github.com/soffes/ssziparchive.git', :tag => "v#{s.version}" } s.ios.deployment_target = '4.0' s.osx.deployment_target = '10.6' s.source_files = 'SSZipArchive/*', 'SSZipArchive/minizip/*' + s.public_header_files = 'SSZipArchive/*.h' s.library = 'z' s.requires_arc = true end diff --git a/SSZipArchive/Common.h b/SSZipArchive/Common.h new file mode 100644 index 0000000..0afeeba --- /dev/null +++ b/SSZipArchive/Common.h @@ -0,0 +1,43 @@ +#ifndef SSZipCommon +#define SSZipCommon + +/* tm_unz contain date/time info */ +typedef struct tm_unz_s +{ + unsigned int tm_sec; /* seconds after the minute - [0,59] */ + unsigned int tm_min; /* minutes after the hour - [0,59] */ + unsigned int tm_hour; /* hours since midnight - [0,23] */ + unsigned int tm_mday; /* day of the month - [1,31] */ + unsigned int tm_mon; /* months since January - [0,11] */ + unsigned int tm_year; /* years - [1980..2044] */ +} tm_unz; + +typedef struct unz_file_info_s +{ + unsigned long version; /* version made by 2 bytes */ + unsigned long version_needed; /* version needed to extract 2 bytes */ + unsigned long flag; /* general purpose bit flag 2 bytes */ + unsigned long compression_method; /* compression method 2 bytes */ + unsigned long dosDate; /* last mod file date in Dos fmt 4 bytes */ + unsigned long crc; /* crc-32 4 bytes */ + unsigned long compressed_size; /* compressed size 4 bytes */ + unsigned long uncompressed_size; /* uncompressed size 4 bytes */ + unsigned long size_filename; /* filename length 2 bytes */ + unsigned long size_file_extra; /* extra field length 2 bytes */ + unsigned long size_file_comment; /* file comment length 2 bytes */ + + unsigned long disk_num_start; /* disk number start 2 bytes */ + unsigned long internal_fa; /* internal file attributes 2 bytes */ + unsigned long external_fa; /* external file attributes 4 bytes */ + + tm_unz tmu_date; +} unz_file_info; + +typedef struct unz_global_info_s +{ + unsigned long number_entry; /* total number of entries in + the central dir on this disk */ + unsigned long size_comment; /* size of the global comment of the zipfile */ +} unz_global_info; + +#endif \ No newline at end of file diff --git a/SSZipArchive/SSZipArchive.h b/SSZipArchive/SSZipArchive.h new file mode 100644 index 0000000..6b4daba --- /dev/null +++ b/SSZipArchive/SSZipArchive.h @@ -0,0 +1,69 @@ +// +// SSZipArchive.h +// SSZipArchive +// +// Created by Sam Soffes on 7/21/10. +// Copyright (c) Sam Soffes 2010-2015. All rights reserved. +// + +#ifndef _SSZIPARCHIVE_H +#define _SSZIPARCHIVE_H + +#import +#include "Common.h" + +@protocol SSZipArchiveDelegate; + +@interface SSZipArchive : NSObject + +// Unzip ++ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination; ++ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id)delegate; + ++ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error; ++ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error delegate:(id)delegate; + ++ (BOOL)unzipFileAtPath:(NSString *)path + toDestination:(NSString *)destination + progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler + completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler; + ++ (BOOL)unzipFileAtPath:(NSString *)path + toDestination:(NSString *)destination + overwrite:(BOOL)overwrite + password:(NSString *)password + progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler + completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler; + +// Zip ++ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)filenames; ++ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath; ++ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory; + +- (instancetype)initWithPath:(NSString *)path; +@property (NS_NONATOMIC_IOSONLY, readonly) BOOL open; +- (BOOL)writeFile:(NSString *)path; +- (BOOL)writeFileAtPath:(NSString *)path withFileName:(NSString *)fileName; +- (BOOL)writeData:(NSData *)data filename:(NSString *)filename; +@property (NS_NONATOMIC_IOSONLY, readonly) BOOL close; + +@end + +@protocol SSZipArchiveDelegate + +@optional + +- (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo; +- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath; + +- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; +- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; +- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; +- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath; + +- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total; +- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath; + +@end + +#endif /* _SSZIPARCHIVE_H */ diff --git a/SSZipArchive/SSZipArchive.m b/SSZipArchive/SSZipArchive.m new file mode 100644 index 0000000..9af8738 --- /dev/null +++ b/SSZipArchive/SSZipArchive.m @@ -0,0 +1,673 @@ +// +// SSZipArchive.m +// SSZipArchive +// +// Created by Sam Soffes on 7/21/10. +// Copyright (c) Sam Soffes 2010-2015. All rights reserved. +// + +#import "SSZipArchive.h" +#include "unzip.h" +#include "zip.h" +#import "zlib.h" +#import "zconf.h" + +#include + +#define CHUNK 16384 + +@interface SSZipArchive () ++ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime; +@end + +@implementation SSZipArchive +{ + NSString *_path; + NSString *_filename; + zipFile _zip; +} + +#pragma mark - Unzipping + ++ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination +{ + return [self unzipFileAtPath:path toDestination:destination delegate:nil]; +} + ++ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error +{ + return [self unzipFileAtPath:path toDestination:destination overwrite:overwrite password:password error:error delegate:nil progressHandler:nil completionHandler:nil]; +} + ++ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id)delegate +{ + return [self unzipFileAtPath:path toDestination:destination overwrite:YES password:nil error:nil delegate:delegate progressHandler:nil completionHandler:nil]; +} + ++ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error delegate:(id)delegate +{ + return [self unzipFileAtPath:path toDestination:destination overwrite:overwrite password:password error:error delegate:delegate progressHandler:nil completionHandler:nil]; +} + ++ (BOOL)unzipFileAtPath:(NSString *)path + toDestination:(NSString *)destination + overwrite:(BOOL)overwrite + password:(NSString *)password + progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler + completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler +{ + return [self unzipFileAtPath:path toDestination:destination overwrite:overwrite password:password error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler]; +} + ++ (BOOL)unzipFileAtPath:(NSString *)path + toDestination:(NSString *)destination + progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler + completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler +{ + return [self unzipFileAtPath:path toDestination:destination overwrite:YES password:nil error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler]; +} + ++ (BOOL)unzipFileAtPath:(NSString *)path + toDestination:(NSString *)destination + overwrite:(BOOL)overwrite + password:(NSString *)password + error:(NSError **)error + delegate:(id)delegate + progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler + completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler +{ + // Begin opening + zipFile zip = unzOpen((const char*)[path UTF8String]); + if (zip == NULL) + { + NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open zip file"}; + NSError *err = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-1 userInfo:userInfo]; + if (error) + { + *error = err; + } + if (completionHandler) + { + completionHandler(nil, NO, err); + } + return NO; + } + + NSDictionary * fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil]; + unsigned long long fileSize = [fileAttributes[NSFileSize] unsignedLongLongValue]; + unsigned long long currentPosition = 0; + + unz_global_info globalInfo = {0ul, 0ul}; + unzGetGlobalInfo(zip, &globalInfo); + + // Begin unzipping + if (unzGoToFirstFile(zip) != UNZ_OK) + { + NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open first file in zip file"}; + NSError *err = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-2 userInfo:userInfo]; + if (error) + { + *error = err; + } + if (completionHandler) + { + completionHandler(nil, NO, err); + } + return NO; + } + + BOOL success = YES; + BOOL canceled = NO; + int ret = 0; + unsigned char buffer[4096] = {0}; + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSMutableSet *directoriesModificationDates = [[NSMutableSet alloc] init]; + + // Message delegate + if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipArchiveAtPath:zipInfo:)]) { + [delegate zipArchiveWillUnzipArchiveAtPath:path zipInfo:globalInfo]; + } + if ([delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { + [delegate zipArchiveProgressEvent:(NSInteger)currentPosition total:(NSInteger)fileSize]; + } + + NSInteger currentFileNumber = 0; + do { + @autoreleasepool { + if ([password length] == 0) { + ret = unzOpenCurrentFile(zip); + } else { + ret = unzOpenCurrentFilePassword(zip, [password cStringUsingEncoding:NSASCIIStringEncoding]); + } + + if (ret != UNZ_OK) { + success = NO; + break; + } + + // Reading data and write to file + unz_file_info fileInfo; + memset(&fileInfo, 0, sizeof(unz_file_info)); + + ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0); + if (ret != UNZ_OK) { + success = NO; + unzCloseCurrentFile(zip); + break; + } + + currentPosition += fileInfo.compressed_size; + + // Message delegate + if ([delegate respondsToSelector:@selector(zipArchiveShouldUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { + if (![delegate zipArchiveShouldUnzipFileAtIndex:currentFileNumber + totalFiles:(NSInteger)globalInfo.number_entry + archivePath:path fileInfo:fileInfo]) { + success = NO; + canceled = YES; + break; + } + } + if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { + [delegate zipArchiveWillUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry + archivePath:path fileInfo:fileInfo]; + } + if ([delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { + [delegate zipArchiveProgressEvent:(NSInteger)currentPosition total:(NSInteger)fileSize]; + } + + char *filename = (char *)malloc(fileInfo.size_filename + 1); + unzGetCurrentFileInfo(zip, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); + filename[fileInfo.size_filename] = '\0'; + + // + // Determine whether this is a symbolic link: + // - File is stored with 'version made by' value of UNIX (3), + // as per http://www.pkware.com/documents/casestudies/APPNOTE.TXT + // in the upper byte of the version field. + // - BSD4.4 st_mode constants are stored in the high 16 bits of the + // external file attributes (defacto standard, verified against libarchive) + // + // The original constants can be found here: + // http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/include/sys/stat.h + // + const uLong ZipUNIXVersion = 3; + const uLong BSD_SFMT = 0170000; + const uLong BSD_IFLNK = 0120000; + + BOOL fileIsSymbolicLink = NO; + if (((fileInfo.version >> 8) == ZipUNIXVersion) && BSD_IFLNK == (BSD_SFMT & (fileInfo.external_fa >> 16))) { + fileIsSymbolicLink = NO; + } + + // Check if it contains directory + NSString *strPath = @(filename); + BOOL isDirectory = NO; + if (filename[fileInfo.size_filename-1] == '/' || filename[fileInfo.size_filename-1] == '\\') { + isDirectory = YES; + } + free(filename); + + // Contains a path + if ([strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location != NSNotFound) { + strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; + } + + NSString *fullPath = [destination stringByAppendingPathComponent:strPath]; + NSError *err = nil; + NSDate *modDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate]; + NSDictionary *directoryAttr = @{NSFileCreationDate: modDate, NSFileModificationDate: modDate}; + + if (isDirectory) { + [fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err]; + } else { + [fileManager createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:directoryAttr error:&err]; + } + if (nil != err) { + NSLog(@"[SSZipArchive] Error: %@", err.localizedDescription); + } + + if(!fileIsSymbolicLink) + [directoriesModificationDates addObject: @{@"path": fullPath, @"modDate": modDate}]; + + if ([fileManager fileExistsAtPath:fullPath] && !isDirectory && !overwrite) { + unzCloseCurrentFile(zip); + ret = unzGoToNextFile(zip); + continue; + } + + if (!fileIsSymbolicLink) { + FILE *fp = fopen((const char*)[fullPath UTF8String], "wb"); + while (fp) { + int readBytes = unzReadCurrentFile(zip, buffer, 4096); + + if (readBytes > 0) { + fwrite(buffer, readBytes, 1, fp ); + } else { + break; + } + } + + if (fp) { + if ([[[fullPath pathExtension] lowercaseString] isEqualToString:@"zip"]) { + NSLog(@"Unzipping nested .zip file: %@", [fullPath lastPathComponent]); + if ([self unzipFileAtPath:fullPath toDestination:[fullPath stringByDeletingLastPathComponent] overwrite:overwrite password:password error:nil delegate:nil]) { + [[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil]; + } + } + + fclose(fp); + + // 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); + } + } + + unzCloseCurrentFile( zip ); + 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 + if (success && [delegate respondsToSelector:@selector(zipArchiveDidUnzipArchiveAtPath:zipInfo:unzippedPath:)]) { + [delegate zipArchiveDidUnzipArchiveAtPath:path zipInfo:globalInfo unzippedPath:destination]; + } + // final progress event = 100% + if (!canceled && [delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { + [delegate zipArchiveProgressEvent:fileSize total:fileSize]; + } + + if (completionHandler) + { + completionHandler(path, YES, nil); + } + return success; +} + +#pragma mark - Zipping + ++ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths +{ + BOOL success = NO; + SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path]; + if ([zipArchive open]) { + for (NSString *filePath in paths) { + [zipArchive writeFile:filePath]; + } + success = [zipArchive close]; + } + +#if !__has_feature(objc_arc) + [zipArchive release]; +#endif + + return success; +} + ++ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath { + return [self createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:NO]; +} + + ++ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory { + BOOL success = NO; + + NSFileManager *fileManager = nil; + SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path]; + + if ([zipArchive open]) { + // use a local filemanager (queue/thread compatibility) + fileManager = [[NSFileManager alloc] init]; + NSDirectoryEnumerator *dirEnumerator = [fileManager enumeratorAtPath:directoryPath]; + NSString *fileName; + while ((fileName = [dirEnumerator nextObject])) { + BOOL isDir; + NSString *fullFilePath = [directoryPath stringByAppendingPathComponent:fileName]; + [fileManager fileExistsAtPath:fullFilePath isDirectory:&isDir]; + if (!isDir) { + if (keepParentDirectory) + { + fileName = [[directoryPath lastPathComponent] stringByAppendingPathComponent:fileName]; + } + [zipArchive writeFileAtPath:fullFilePath withFileName:fileName]; + } + else + { + if([[NSFileManager defaultManager] subpathsOfDirectoryAtPath:fullFilePath error:nil].count == 0) + { + NSString *tempName = [fullFilePath stringByAppendingPathComponent:@".DS_Store"]; + [@"" writeToFile:tempName atomically:YES encoding:NSUTF8StringEncoding error:nil]; + [zipArchive writeFileAtPath:tempName withFileName:[fileName stringByAppendingPathComponent:@".DS_Store"]]; + [[NSFileManager defaultManager] removeItemAtPath:tempName error:nil]; + } + } + } + success = [zipArchive close]; + } + +#if !__has_feature(objc_arc) + [fileManager release]; + [zipArchive release]; +#endif + + return success; +} + + +- (instancetype)initWithPath:(NSString *)path +{ + if ((self = [super init])) { + _path = [path copy]; + } + return self; +} + + +#if !__has_feature(objc_arc) +- (void)dealloc +{ + [_path release]; + [super dealloc]; +} +#endif + + +- (BOOL)open +{ + NSAssert((_zip == NULL), @"Attempting open an archive which is already open"); + _zip = zipOpen([_path UTF8String], APPEND_STATUS_CREATE); + return (NULL != _zip); +} + + +- (void)zipInfo:(zip_fileinfo*)zipInfo setDate:(NSDate*)date +{ + NSCalendar *currentCalendar = [NSCalendar currentCalendar]; +#if defined(__IPHONE_8_0) || defined(__MAC_10_10) + uint flags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; +#else + uint flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; +#endif + NSDateComponents *components = [currentCalendar components:flags fromDate:date]; + zipInfo->tmz_date.tm_sec = (unsigned int)components.second; + zipInfo->tmz_date.tm_min = (unsigned int)components.minute; + zipInfo->tmz_date.tm_hour = (unsigned int)components.hour; + zipInfo->tmz_date.tm_mday = (unsigned int)components.day; + zipInfo->tmz_date.tm_mon = (unsigned int)components.month - 1; + zipInfo->tmz_date.tm_year = (unsigned int)components.year; +} + +- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName +{ + NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened"); + + zip_fileinfo zipInfo = {{0}}; + + NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error: nil]; + if( attr ) + { + NSDate *fileDate = (NSDate *)attr[NSFileModificationDate]; + if( fileDate ) + { + [self zipInfo:&zipInfo setDate: fileDate ]; + } + + // Write permissions into the external attributes, for details on this see here: http://unix.stackexchange.com/a/14727 + // Get the permissions value from the files attributes + NSNumber *permissionsValue = (NSNumber *)attr[NSFilePosixPermissions]; + if (permissionsValue) { + // Get the short value for the permissions + short permissionsShort = permissionsValue.shortValue; + + // Convert this into an octal by adding 010000, 010000 being the flag for a regular file + NSInteger permissionsOctal = 0100000 + permissionsShort; + + // Convert this into a long value + uLong permissionsLong = @(permissionsOctal).unsignedLongValue; + + // Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte + zipInfo.external_fa = permissionsLong << 16L; + } + } + + unsigned int len = 0; + zipOpenNewFileInZip(_zip, [[folderName stringByAppendingString:@"/"] UTF8String], &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_NO_COMPRESSION); + zipWriteInFileInZip(_zip, &len, 0); + zipCloseFileInZip(_zip); + return YES; +} + +- (BOOL)writeFile:(NSString *)path +{ + return [self writeFileAtPath:path withFileName:nil]; +} + +// supports writing files with logical folder/directory structure +// *path* is the absolute path of the file that will be compressed +// *fileName* is the relative name of the file how it is stored within the zip e.g. /folder/subfolder/text1.txt +- (BOOL)writeFileAtPath:(NSString *)path withFileName:(NSString *)fileName +{ + NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened"); + + FILE *input = fopen([path UTF8String], "r"); + if (NULL == input) { + return NO; + } + + const char *afileName; + if (!fileName) { + afileName = [path.lastPathComponent UTF8String]; + } + else { + afileName = [fileName UTF8String]; + } + + zip_fileinfo zipInfo = {{0}}; + + NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error: nil]; + if( attr ) + { + NSDate *fileDate = (NSDate *)attr[NSFileModificationDate]; + if( fileDate ) + { + [self zipInfo:&zipInfo setDate: fileDate ]; + } + + // Write permissions into the external attributes, for details on this see here: http://unix.stackexchange.com/a/14727 + // Get the permissions value from the files attributes + NSNumber *permissionsValue = (NSNumber *)attr[NSFilePosixPermissions]; + if (permissionsValue) { + // Get the short value for the permissions + short permissionsShort = permissionsValue.shortValue; + + // Convert this into an octal by adding 010000, 010000 being the flag for a regular file + NSInteger permissionsOctal = 0100000 + permissionsShort; + + // Convert this into a long value + uLong permissionsLong = @(permissionsOctal).unsignedLongValue; + + // Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte + zipInfo.external_fa = permissionsLong << 16L; + } + } + + zipOpenNewFileInZip(_zip, afileName, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION); + + void *buffer = malloc(CHUNK); + unsigned int len = 0; + + while (!feof(input)) + { + len = (unsigned int) fread(buffer, 1, CHUNK, input); + zipWriteInFileInZip(_zip, buffer, len); + } + + zipCloseFileInZip(_zip); + free(buffer); + return YES; +} + +- (BOOL)writeData:(NSData *)data filename:(NSString *)filename +{ + if (!_zip) { + return NO; + } + if (!data) { + return NO; + } + zip_fileinfo zipInfo = {{0,0,0,0,0,0},0,0,0}; + [self zipInfo:&zipInfo setDate:[NSDate date]]; + + zipOpenNewFileInZip(_zip, [filename UTF8String], &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION); + + zipWriteInFileInZip(_zip, data.bytes, (unsigned int)data.length); + + zipCloseFileInZip(_zip); + return YES; +} + + +- (BOOL)close +{ + NSAssert((_zip != NULL), @"[SSZipArchive] Attempting to close an archive which was never opened"); + zipClose(_zip, NULL); + return YES; +} + +#pragma mark - Private + +// Format from http://newsgroups.derkeiler.com/Archive/Comp/comp.os.msdos.programmer/2009-04/msg00060.html +// Two consecutive words, or a longword, YYYYYYYMMMMDDDDD hhhhhmmmmmmsssss +// YYYYYYY is years from 1980 = 0 +// sssss is (seconds/2). +// +// 3658 = 0011 0110 0101 1000 = 0011011 0010 11000 = 27 2 24 = 2007-02-24 +// 7423 = 0111 0100 0010 0011 - 01110 100001 00011 = 14 33 2 = 14:33:06 ++ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime +{ + static const UInt32 kYearMask = 0xFE000000; + static const UInt32 kMonthMask = 0x1E00000; + static const UInt32 kDayMask = 0x1F0000; + static const UInt32 kHourMask = 0xF800; + static const UInt32 kMinuteMask = 0x7E0; + static const UInt32 kSecondMask = 0x1F; + + static NSCalendar *gregorian; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ +#if defined(__IPHONE_8_0) || defined(__MAC_10_10) + gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; +#else + gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; +#endif + }); + + NSDateComponents *components = [[NSDateComponents alloc] init]; + + NSAssert(0xFFFFFFFF == (kYearMask | kMonthMask | kDayMask | kHourMask | kMinuteMask | kSecondMask), @"[SSZipArchive] MSDOS date masks don't add up"); + + [components setYear:1980 + ((msdosDateTime & kYearMask) >> 25)]; + [components setMonth:(msdosDateTime & kMonthMask) >> 21]; + [components setDay:(msdosDateTime & kDayMask) >> 16]; + [components setHour:(msdosDateTime & kHourMask) >> 11]; + [components setMinute:(msdosDateTime & kMinuteMask) >> 5]; + [components setSecond:(msdosDateTime & kSecondMask) * 2]; + + NSDate *date = [NSDate dateWithTimeInterval:0 sinceDate:[gregorian dateFromComponents:components]]; + +#if !__has_feature(objc_arc) + [components release]; +#endif + + return date; +} + +@end diff --git a/ZipArchive/minizip/crypt.h b/SSZipArchive/minizip/crypt.h similarity index 100% rename from ZipArchive/minizip/crypt.h rename to SSZipArchive/minizip/crypt.h diff --git a/ZipArchive/minizip/ioapi.c b/SSZipArchive/minizip/ioapi.c similarity index 100% rename from ZipArchive/minizip/ioapi.c rename to SSZipArchive/minizip/ioapi.c diff --git a/ZipArchive/minizip/ioapi.h b/SSZipArchive/minizip/ioapi.h similarity index 100% rename from ZipArchive/minizip/ioapi.h rename to SSZipArchive/minizip/ioapi.h diff --git a/ZipArchive/minizip/mztools.c b/SSZipArchive/minizip/mztools.c similarity index 100% rename from ZipArchive/minizip/mztools.c rename to SSZipArchive/minizip/mztools.c diff --git a/ZipArchive/minizip/mztools.h b/SSZipArchive/minizip/mztools.h similarity index 100% rename from ZipArchive/minizip/mztools.h rename to SSZipArchive/minizip/mztools.h diff --git a/ZipArchive/minizip/unzip.c b/SSZipArchive/minizip/unzip.c similarity index 100% rename from ZipArchive/minizip/unzip.c rename to SSZipArchive/minizip/unzip.c diff --git a/ZipArchive/minizip/unzip.h b/SSZipArchive/minizip/unzip.h similarity index 88% rename from ZipArchive/minizip/unzip.h rename to SSZipArchive/minizip/unzip.h index 3183968..39c168d 100755 --- a/ZipArchive/minizip/unzip.h +++ b/SSZipArchive/minizip/unzip.h @@ -70,6 +70,7 @@ typedef unzFile__ *unzFile; typedef voidp unzFile; #endif +#include "../Common.h" #define UNZ_OK (0) #define UNZ_END_OF_LIST_OF_FILE (-100) @@ -80,17 +81,6 @@ typedef voidp unzFile; #define UNZ_INTERNALERROR (-104) #define UNZ_CRCERROR (-105) -/* tm_unz contain date/time info */ -typedef struct tm_unz_s -{ - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ -} tm_unz; - /* unz_global_info structure contain global data about the ZIPfile These data comes from the end of central dir */ typedef struct unz_global_info64_s @@ -100,13 +90,6 @@ typedef struct unz_global_info64_s uLong size_comment; /* size of the global comment of the zipfile */ } unz_global_info64; -typedef struct unz_global_info_s -{ - uLong number_entry; /* total number of entries in - the central dir on this disk */ - uLong size_comment; /* size of the global comment of the zipfile */ -} unz_global_info; - /* unz_file_info contain information about a file in the zipfile */ typedef struct unz_file_info64_s { @@ -129,27 +112,6 @@ typedef struct unz_file_info64_s tm_unz tmu_date; } unz_file_info64; -typedef struct unz_file_info_s -{ - uLong version; /* version made by 2 bytes */ - uLong version_needed; /* version needed to extract 2 bytes */ - uLong flag; /* general purpose bit flag 2 bytes */ - uLong compression_method; /* compression method 2 bytes */ - uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ - uLong crc; /* crc-32 4 bytes */ - uLong compressed_size; /* compressed size 4 bytes */ - uLong uncompressed_size; /* uncompressed size 4 bytes */ - uLong size_filename; /* filename length 2 bytes */ - uLong size_file_extra; /* extra field length 2 bytes */ - uLong size_file_comment; /* file comment length 2 bytes */ - - uLong disk_num_start; /* disk number start 2 bytes */ - uLong internal_fa; /* internal file attributes 2 bytes */ - uLong external_fa; /* external file attributes 4 bytes */ - - tm_unz tmu_date; -} unz_file_info; - extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, const char* fileName2, int iCaseSensitivity)); diff --git a/ZipArchive/minizip/zip.c b/SSZipArchive/minizip/zip.c similarity index 100% rename from ZipArchive/minizip/zip.c rename to SSZipArchive/minizip/zip.c diff --git a/ZipArchive/minizip/zip.h b/SSZipArchive/minizip/zip.h similarity index 100% rename from ZipArchive/minizip/zip.h rename to SSZipArchive/minizip/zip.h diff --git a/SwiftExample/Podfile b/SwiftExample/Podfile new file mode 100644 index 0000000..0e0381f --- /dev/null +++ b/SwiftExample/Podfile @@ -0,0 +1,8 @@ +source 'https://github.com/CocoaPods/Specs.git' + +# inhibit_all_warnings! +use_frameworks! + +target 'SwiftExample' do + pod 'SSZipArchive', :path => '..' +end diff --git a/SwiftExample/Podfile.lock b/SwiftExample/Podfile.lock new file mode 100644 index 0000000..e2c38d1 --- /dev/null +++ b/SwiftExample/Podfile.lock @@ -0,0 +1,14 @@ +PODS: + - SSZipArchive (0.3.2) + +DEPENDENCIES: + - SSZipArchive (from `..`) + +EXTERNAL SOURCES: + SSZipArchive: + :path: ".." + +SPEC CHECKSUMS: + SSZipArchive: 0f61dba1ab479a636f095aaf75a6cdafb5ff9d0c + +COCOAPODS: 0.39.0 diff --git a/SwiftExample/SwiftExample.xcodeproj/project.pbxproj b/SwiftExample/SwiftExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..396a740 --- /dev/null +++ b/SwiftExample/SwiftExample.xcodeproj/project.pbxproj @@ -0,0 +1,528 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 5914648EC4509E192D31CA42 /* Pods_SwiftExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E81180168B01E0210FE1E3F /* Pods_SwiftExample.framework */; }; + 8DFE190D1BDA74F800709011 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE190C1BDA74F800709011 /* AppDelegate.swift */; }; + 8DFE190F1BDA74F800709011 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE190E1BDA74F800709011 /* ViewController.swift */; }; + 8DFE19121BDA74F800709011 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19101BDA74F800709011 /* Main.storyboard */; }; + 8DFE19141BDA74F800709011 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19131BDA74F800709011 /* Assets.xcassets */; }; + 8DFE19171BDA74F800709011 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19151BDA74F800709011 /* LaunchScreen.storyboard */; }; + 8DFE19221BDA74F800709011 /* SwiftExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19211BDA74F800709011 /* SwiftExampleTests.swift */; }; + 8DFE19421BDA7D8D00709011 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19391BDA7D8C00709011 /* mztools.c */; }; + 8DFE19471BDA82EA00709011 /* Sample Data in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19461BDA82EA00709011 /* Sample Data */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 8DFE191E1BDA74F800709011 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 8DFE19011BDA74F800709011 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DFE19081BDA74F800709011; + remoteInfo = SwiftExample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 8DFE19091BDA74F800709011 /* SwiftExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 8DFE190C1BDA74F800709011 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 8DFE190E1BDA74F800709011 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 8DFE19111BDA74F800709011 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 8DFE19131BDA74F800709011 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 8DFE19161BDA74F800709011 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 8DFE19181BDA74F800709011 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8DFE191D1BDA74F800709011 /* SwiftExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 8DFE19211BDA74F800709011 /* SwiftExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftExampleTests.swift; sourceTree = ""; }; + 8DFE19231BDA74F800709011 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8DFE19341BDA7D8C00709011 /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = ""; }; + 8DFE19361BDA7D8C00709011 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt.h; sourceTree = ""; }; + 8DFE19371BDA7D8C00709011 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ioapi.c; sourceTree = ""; }; + 8DFE19381BDA7D8C00709011 /* ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ioapi.h; sourceTree = ""; }; + 8DFE19391BDA7D8C00709011 /* mztools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mztools.c; sourceTree = ""; }; + 8DFE193A1BDA7D8C00709011 /* mztools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mztools.h; sourceTree = ""; }; + 8DFE193B1BDA7D8C00709011 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unzip.c; sourceTree = ""; }; + 8DFE193C1BDA7D8C00709011 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = ""; }; + 8DFE193D1BDA7D8C00709011 /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip.c; sourceTree = ""; }; + 8DFE193E1BDA7D8C00709011 /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zip.h; sourceTree = ""; }; + 8DFE193F1BDA7D8C00709011 /* SSZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSZipArchive.h; sourceTree = ""; }; + 8DFE19401BDA7D8D00709011 /* SSZipArchive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSZipArchive.m; sourceTree = ""; }; + 8DFE19461BDA82EA00709011 /* Sample Data */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "Sample Data"; sourceTree = ""; }; + 9E81180168B01E0210FE1E3F /* Pods_SwiftExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + EDFB736C117CB42411E221E3 /* Pods-SwiftExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.release.xcconfig"; sourceTree = ""; }; + FA88DF2AF701AB45DE8B7EB5 /* Pods-SwiftExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DFE19061BDA74F800709011 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5914648EC4509E192D31CA42 /* Pods_SwiftExample.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DFE191A1BDA74F800709011 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1B67DA700507825BD99DCEA7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 9E81180168B01E0210FE1E3F /* Pods_SwiftExample.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 8DFE19001BDA74F800709011 = { + isa = PBXGroup; + children = ( + 8DFE19331BDA7D8C00709011 /* SSZipArchive */, + 8DFE190B1BDA74F800709011 /* SwiftExample */, + 8DFE19201BDA74F800709011 /* SwiftExampleTests */, + 8DFE190A1BDA74F800709011 /* Products */, + F5943061786EAFF4CAE16D45 /* Pods */, + 1B67DA700507825BD99DCEA7 /* Frameworks */, + ); + sourceTree = ""; + }; + 8DFE190A1BDA74F800709011 /* Products */ = { + isa = PBXGroup; + children = ( + 8DFE19091BDA74F800709011 /* SwiftExample.app */, + 8DFE191D1BDA74F800709011 /* SwiftExampleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 8DFE190B1BDA74F800709011 /* SwiftExample */ = { + isa = PBXGroup; + children = ( + 8DFE190C1BDA74F800709011 /* AppDelegate.swift */, + 8DFE190E1BDA74F800709011 /* ViewController.swift */, + 8DFE19101BDA74F800709011 /* Main.storyboard */, + 8DFE19131BDA74F800709011 /* Assets.xcassets */, + 8DFE19151BDA74F800709011 /* LaunchScreen.storyboard */, + 8DFE19181BDA74F800709011 /* Info.plist */, + 8DFE19461BDA82EA00709011 /* Sample Data */, + ); + path = SwiftExample; + sourceTree = ""; + }; + 8DFE19201BDA74F800709011 /* SwiftExampleTests */ = { + isa = PBXGroup; + children = ( + 8DFE19211BDA74F800709011 /* SwiftExampleTests.swift */, + 8DFE19231BDA74F800709011 /* Info.plist */, + ); + path = SwiftExampleTests; + sourceTree = ""; + }; + 8DFE19331BDA7D8C00709011 /* SSZipArchive */ = { + isa = PBXGroup; + children = ( + 8DFE19341BDA7D8C00709011 /* Common.h */, + 8DFE193F1BDA7D8C00709011 /* SSZipArchive.h */, + 8DFE19401BDA7D8D00709011 /* SSZipArchive.m */, + 8DFE19351BDA7D8C00709011 /* minizip */, + ); + name = SSZipArchive; + path = ../SSZipArchive; + sourceTree = ""; + }; + 8DFE19351BDA7D8C00709011 /* minizip */ = { + isa = PBXGroup; + children = ( + 8DFE19361BDA7D8C00709011 /* crypt.h */, + 8DFE19371BDA7D8C00709011 /* ioapi.c */, + 8DFE19381BDA7D8C00709011 /* ioapi.h */, + 8DFE19391BDA7D8C00709011 /* mztools.c */, + 8DFE193A1BDA7D8C00709011 /* mztools.h */, + 8DFE193B1BDA7D8C00709011 /* unzip.c */, + 8DFE193C1BDA7D8C00709011 /* unzip.h */, + 8DFE193D1BDA7D8C00709011 /* zip.c */, + 8DFE193E1BDA7D8C00709011 /* zip.h */, + ); + path = minizip; + sourceTree = ""; + }; + F5943061786EAFF4CAE16D45 /* Pods */ = { + isa = PBXGroup; + children = ( + FA88DF2AF701AB45DE8B7EB5 /* Pods-SwiftExample.debug.xcconfig */, + EDFB736C117CB42411E221E3 /* Pods-SwiftExample.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8DFE19081BDA74F800709011 /* SwiftExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8DFE19261BDA74F800709011 /* Build configuration list for PBXNativeTarget "SwiftExample" */; + buildPhases = ( + E78B00A33CAF266DB67D6E49 /* Check Pods Manifest.lock */, + 8DFE19051BDA74F800709011 /* Sources */, + 8DFE19061BDA74F800709011 /* Frameworks */, + 8DFE19071BDA74F800709011 /* Resources */, + AEFD7A965DD623210F3FCEAA /* Embed Pods Frameworks */, + D85ACD9C6E611B2AC2024437 /* Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwiftExample; + productName = SwiftExample; + productReference = 8DFE19091BDA74F800709011 /* SwiftExample.app */; + productType = "com.apple.product-type.application"; + }; + 8DFE191C1BDA74F800709011 /* SwiftExampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8DFE19291BDA74F800709011 /* Build configuration list for PBXNativeTarget "SwiftExampleTests" */; + buildPhases = ( + 8DFE19191BDA74F800709011 /* Sources */, + 8DFE191A1BDA74F800709011 /* Frameworks */, + 8DFE191B1BDA74F800709011 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 8DFE191F1BDA74F800709011 /* PBXTargetDependency */, + ); + name = SwiftExampleTests; + productName = SwiftExampleTests; + productReference = 8DFE191D1BDA74F800709011 /* SwiftExampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 8DFE19011BDA74F800709011 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0710; + LastUpgradeCheck = 0710; + TargetAttributes = { + 8DFE19081BDA74F800709011 = { + CreatedOnToolsVersion = 7.1; + }; + 8DFE191C1BDA74F800709011 = { + CreatedOnToolsVersion = 7.1; + TestTargetID = 8DFE19081BDA74F800709011; + }; + }; + }; + buildConfigurationList = 8DFE19041BDA74F800709011 /* Build configuration list for PBXProject "SwiftExample" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 8DFE19001BDA74F800709011; + productRefGroup = 8DFE190A1BDA74F800709011 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DFE19081BDA74F800709011 /* SwiftExample */, + 8DFE191C1BDA74F800709011 /* SwiftExampleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8DFE19071BDA74F800709011 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DFE19171BDA74F800709011 /* LaunchScreen.storyboard in Resources */, + 8DFE19141BDA74F800709011 /* Assets.xcassets in Resources */, + 8DFE19121BDA74F800709011 /* Main.storyboard in Resources */, + 8DFE19471BDA82EA00709011 /* Sample Data in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DFE191B1BDA74F800709011 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + AEFD7A965DD623210F3FCEAA /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + D85ACD9C6E611B2AC2024437 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + E78B00A33CAF266DB67D6E49 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DFE19051BDA74F800709011 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DFE19421BDA7D8D00709011 /* mztools.c in Sources */, + 8DFE190F1BDA74F800709011 /* ViewController.swift in Sources */, + 8DFE190D1BDA74F800709011 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8DFE19191BDA74F800709011 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DFE19221BDA74F800709011 /* SwiftExampleTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 8DFE191F1BDA74F800709011 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DFE19081BDA74F800709011 /* SwiftExample */; + targetProxy = 8DFE191E1BDA74F800709011 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 8DFE19101BDA74F800709011 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 8DFE19111BDA74F800709011 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 8DFE19151BDA74F800709011 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 8DFE19161BDA74F800709011 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 8DFE19241BDA74F800709011 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 8DFE19251BDA74F800709011 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.1; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 8DFE19271BDA74F800709011 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = FA88DF2AF701AB45DE8B7EB5 /* Pods-SwiftExample.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = SwiftExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 8DFE19281BDA74F800709011 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = EDFB736C117CB42411E221E3 /* Pods-SwiftExample.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = SwiftExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 8DFE192A1BDA74F800709011 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + INFOPLIST_FILE = SwiftExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample"; + }; + name = Debug; + }; + 8DFE192B1BDA74F800709011 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + INFOPLIST_FILE = SwiftExampleTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 8DFE19041BDA74F800709011 /* Build configuration list for PBXProject "SwiftExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8DFE19241BDA74F800709011 /* Debug */, + 8DFE19251BDA74F800709011 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8DFE19261BDA74F800709011 /* Build configuration list for PBXNativeTarget "SwiftExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8DFE19271BDA74F800709011 /* Debug */, + 8DFE19281BDA74F800709011 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8DFE19291BDA74F800709011 /* Build configuration list for PBXNativeTarget "SwiftExampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8DFE192A1BDA74F800709011 /* Debug */, + 8DFE192B1BDA74F800709011 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 8DFE19011BDA74F800709011 /* Project object */; +} diff --git a/ZipArchive.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 69% rename from ZipArchive.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 6bcded8..feaeda1 100644 --- a/ZipArchive.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:SwiftExample.xcodeproj"> diff --git a/SwiftExample/SwiftExample.xcworkspace/contents.xcworkspacedata b/SwiftExample/SwiftExample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..238f90a --- /dev/null +++ b/SwiftExample/SwiftExample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/SwiftExample/SwiftExample/AppDelegate.swift b/SwiftExample/SwiftExample/AppDelegate.swift new file mode 100644 index 0000000..d118200 --- /dev/null +++ b/SwiftExample/SwiftExample/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// SwiftExample +// +// Created by Sean Soper on 10/23/15. +// +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(application: UIApplication) { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/SwiftExample/SwiftExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/SwiftExample/SwiftExample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..36d2c80 --- /dev/null +++ b/SwiftExample/SwiftExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SwiftExample/SwiftExample/Base.lproj/LaunchScreen.storyboard b/SwiftExample/SwiftExample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..2e721e1 --- /dev/null +++ b/SwiftExample/SwiftExample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SwiftExample/SwiftExample/Base.lproj/Main.storyboard b/SwiftExample/SwiftExample/Base.lproj/Main.storyboard new file mode 100644 index 0000000..89081ef --- /dev/null +++ b/SwiftExample/SwiftExample/Base.lproj/Main.storyboard @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SwiftExample/SwiftExample/Info.plist b/SwiftExample/SwiftExample/Info.plist new file mode 100644 index 0000000..40c6215 --- /dev/null +++ b/SwiftExample/SwiftExample/Info.plist @@ -0,0 +1,47 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/SwiftExample/SwiftExample/Sample Data/China to ban ivory trade.md b/SwiftExample/SwiftExample/Sample Data/China to ban ivory trade.md new file mode 100644 index 0000000..dd5adf7 --- /dev/null +++ b/SwiftExample/SwiftExample/Sample Data/China to ban ivory trade.md @@ -0,0 +1,9 @@ +# China to ban ivory trade + +**HONG KONG** — It could be the beginning of the end for the illicit trade in ivory. + +Last month, on a state visit to Washington, Chinese President Xi Jinping promised to stop the commercial trade in ivory in his country but gave few details about the timing and extent of such a move. + +Now, a senior U.S. government official says that the Chinese ban could be in place within a year or so, with very narrow exceptions, describing it as a “huge” deal. + +Such a move, conservationists say, would be a major step toward ending the poaching crisis that is decimating Africa’s elephant herds. diff --git a/SwiftExample/SwiftExample/Sample Data/Kerry in Syria.md b/SwiftExample/SwiftExample/Sample Data/Kerry in Syria.md new file mode 100644 index 0000000..f1c6c9e --- /dev/null +++ b/SwiftExample/SwiftExample/Sample Data/Kerry in Syria.md @@ -0,0 +1,9 @@ +# Kerry in Syria + +**VIENNA** — The war raging in Syria took center stage for Secretary of State John F. Kerry on Friday as he kicked off a series of meetings with diplomats seeking common ground on a strategy to resolve the grinding conflict. + +But the foreign ministers of the three countries meeting with Kerry — Russia, Saudi Arabia and NATO-member Turkey — carry sharply competing views on how to proceed. + +Saudi Arabia and Turkey, the neighboring country that has been overwhelmed with Syrian refugees, agree with Washington that Syrian President Bashar Al-Assad should eventually leave power. + +Moscow is one of Assad’s biggest backers, and in recent weeks has positioned its military in Syria and conducted heavy airstrikes that have allowed Assad’s forces to resume ground offensives. The Russian military intervention also has alarmed the Pentagon, which is leading a separate air campaign against the Islamic State. \ No newline at end of file diff --git a/SwiftExample/SwiftExample/Sample Data/wapo twitter banner.png b/SwiftExample/SwiftExample/Sample Data/wapo twitter banner.png new file mode 100644 index 0000000..2c2afd1 Binary files /dev/null and b/SwiftExample/SwiftExample/Sample Data/wapo twitter banner.png differ diff --git a/SwiftExample/SwiftExample/ViewController.swift b/SwiftExample/SwiftExample/ViewController.swift new file mode 100644 index 0000000..10a30f8 --- /dev/null +++ b/SwiftExample/SwiftExample/ViewController.swift @@ -0,0 +1,120 @@ +// +// ViewController.swift +// SwiftExample +// +// Created by Sean Soper on 10/23/15. +// +// + +import UIKit +import SSZipArchive + +class ViewController: UIViewController { + + @IBOutlet weak var zipButton: UIButton! + @IBOutlet weak var unzipButton: UIButton! + @IBOutlet weak var resetButton: UIButton! + + @IBOutlet weak var file1: UILabel! + @IBOutlet weak var file2: UILabel! + @IBOutlet weak var file3: UILabel! + + var zipPath: String? + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + // MARK: IBAction + + @IBAction func zipPressed(_: UIButton) { + let sampleDataPath = NSBundle.mainBundle().bundleURL.URLByAppendingPathComponent("Sample Data").path + zipPath = tempZipPath() + + let success = SSZipArchive.createZipFileAtPath(zipPath, withContentsOfDirectory: sampleDataPath) + if success { + unzipButton.enabled = true + zipButton.enabled = false + } + } + + @IBAction func unzipPressed(_: UIButton) { + guard let zipPath = self.zipPath else { + return + } + + guard let unzipPath = tempUnzipPath() else { + return + } + + let success = SSZipArchive.unzipFileAtPath(zipPath, toDestination: unzipPath) + if !success { + return + } + + var items: [String] + do { + items = try NSFileManager.defaultManager().contentsOfDirectoryAtPath(unzipPath) + } catch { + return + } + + for (index, item) in items.enumerate() { + switch index { + case 0: + file1.text = item + case 1: + file2.text = item + case 2: + file3.text = item + default: + print("Went beyond index of assumed files") + } + } + + unzipButton.enabled = false + resetButton.enabled = true + } + + @IBAction func resetPressed(_: UIButton) { + file1.text = "" + file2.text = "" + file3.text = "" + zipButton.enabled = true + unzipButton.enabled = false + resetButton.enabled = false + } + + // MARK: Private + + func tempZipPath() -> String { + var path = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)[0] + path += "/\(NSUUID().UUIDString).zip" + return path + } + + func tempUnzipPath() -> String? { + var path = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)[0] + path += "/\(NSUUID().UUIDString)" + let url = NSURL(fileURLWithPath: path) + + do { + try NSFileManager.defaultManager().createDirectoryAtURL(url, withIntermediateDirectories: true, attributes: nil) + } catch { + return nil + } + + if let path = url.path { + return path + } + + return nil + } + +} diff --git a/ZipArchive/Info.plist b/SwiftExample/SwiftExampleTests/Info.plist similarity index 77% rename from ZipArchive/Info.plist rename to SwiftExample/SwiftExampleTests/Info.plist index ad46e29..ba72822 100644 --- a/ZipArchive/Info.plist +++ b/SwiftExample/SwiftExampleTests/Info.plist @@ -7,20 +7,18 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - io.cosmiclabs.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType - FMWK + BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - + 1 diff --git a/SwiftExample/SwiftExampleTests/SwiftExampleTests.swift b/SwiftExample/SwiftExampleTests/SwiftExampleTests.swift new file mode 100644 index 0000000..e726fc3 --- /dev/null +++ b/SwiftExample/SwiftExampleTests/SwiftExampleTests.swift @@ -0,0 +1,36 @@ +// +// SwiftExampleTests.swift +// SwiftExampleTests +// +// Created by Sean Soper on 10/23/15. +// +// + +import XCTest +@testable import SwiftExample + +class SwiftExampleTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measureBlock { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/ZipArchive.xcodeproj/project.pbxproj b/ZipArchive.xcodeproj/project.pbxproj deleted file mode 100644 index 4e6462c..0000000 --- a/ZipArchive.xcodeproj/project.pbxproj +++ /dev/null @@ -1,743 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - A527EDC11B527FD000CA3DAF /* crypt.h in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D051B51A44C00929105 /* crypt.h */; }; - A527EDC21B527FD000CA3DAF /* ioapi.c in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D061B51A44C00929105 /* ioapi.c */; }; - A527EDC31B527FD000CA3DAF /* ioapi.h in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D071B51A44C00929105 /* ioapi.h */; }; - A527EDC41B527FD000CA3DAF /* mztools.c in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D081B51A44C00929105 /* mztools.c */; }; - A527EDC51B527FD000CA3DAF /* mztools.h in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D091B51A44C00929105 /* mztools.h */; }; - A527EDC61B527FD000CA3DAF /* unzip.c in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D0A1B51A44C00929105 /* unzip.c */; }; - A527EDC71B527FD000CA3DAF /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D0B1B51A44C00929105 /* unzip.h */; }; - A527EDC81B527FD000CA3DAF /* zip.c in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D0C1B51A44C00929105 /* zip.c */; }; - A527EDC91B527FD000CA3DAF /* zip.h in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D0D1B51A44C00929105 /* zip.h */; }; - A527EDCA1B52804E00CA3DAF /* crypt.h in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D051B51A44C00929105 /* crypt.h */; }; - A527EDCB1B52804E00CA3DAF /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D061B51A44C00929105 /* ioapi.c */; }; - A527EDCC1B52804E00CA3DAF /* ioapi.h in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D071B51A44C00929105 /* ioapi.h */; }; - A527EDCD1B52804E00CA3DAF /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D081B51A44C00929105 /* mztools.c */; }; - A527EDCE1B52804E00CA3DAF /* mztools.h in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D091B51A44C00929105 /* mztools.h */; }; - A527EDCF1B52804E00CA3DAF /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D0A1B51A44C00929105 /* unzip.c */; }; - A527EDD01B52804E00CA3DAF /* unzip.h in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D0B1B51A44C00929105 /* unzip.h */; }; - A527EDD11B52804E00CA3DAF /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D0C1B51A44C00929105 /* zip.c */; }; - A527EDD21B52804E00CA3DAF /* zip.h in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D0D1B51A44C00929105 /* zip.h */; }; - A527EDD41B52806D00CA3DAF /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A527EDD31B52806D00CA3DAF /* libz.dylib */; }; - A527EDD91B52809700CA3DAF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A527EDD71B52808900CA3DAF /* Foundation.framework */; }; - A527EDDA1B52809700CA3DAF /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A527EDD51B52808400CA3DAF /* CoreGraphics.framework */; }; - A53101811B5284E200FA26EA /* Main.h in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D181B51A4D000929105 /* Main.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A53101831B528EE100FA26EA /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5D15CBD1B51A38C00929105 /* ZipArchive.framework */; }; - A53101841B528EF200FA26EA /* ZipArchiveTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A5D15CCF1B51A38C00929105 /* ZipArchiveTests.m */; }; - A5D15CC31B51A38C00929105 /* ZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = A5D15CC21B51A38C00929105 /* ZipArchive.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A5D15CE21B51A3A400929105 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A5D15CE11B51A3A400929105 /* main.m */; }; - A5D15CE51B51A3A400929105 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A5D15CE41B51A3A400929105 /* AppDelegate.m */; }; - A5D15CE81B51A3A400929105 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A5D15CE71B51A3A400929105 /* ViewController.m */; }; - A5D15CEB1B51A3A400929105 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A5D15CE91B51A3A400929105 /* Main.storyboard */; }; - A5D15CED1B51A3A400929105 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A5D15CEC1B51A3A400929105 /* Images.xcassets */; }; - A5D15CF01B51A3A400929105 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = A5D15CEE1B51A3A400929105 /* LaunchScreen.xib */; }; - A5D15D1B1B51A4D000929105 /* Main.m in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D191B51A4D000929105 /* Main.m */; }; - A5D15D2B1B51CEAC00929105 /* 0.m4a in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D231B51CEAC00929105 /* 0.m4a */; }; - A5D15D2C1B51CEAC00929105 /* 1.m4a in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D241B51CEAC00929105 /* 1.m4a */; }; - A5D15D2D1B51CEAC00929105 /* 2.m4a in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D251B51CEAC00929105 /* 2.m4a */; }; - A5D15D2E1B51CEAC00929105 /* 3.m4a in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D261B51CEAC00929105 /* 3.m4a */; }; - A5D15D2F1B51CEAC00929105 /* 4.m4a in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D271B51CEAC00929105 /* 4.m4a */; }; - A5D15D301B51CEAC00929105 /* 5.m4a in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D281B51CEAC00929105 /* 5.m4a */; }; - A5D15D311B51CEAC00929105 /* 6.m4a in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D291B51CEAC00929105 /* 6.m4a */; }; - A5D15D321B51CEAC00929105 /* 7.m4a in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D2A1B51CEAC00929105 /* 7.m4a */; }; - A5D15D3C1B51CED100929105 /* hello.zip in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D341B51CED100929105 /* hello.zip */; }; - A5D15D3D1B51CED100929105 /* IncorrectHeaders.zip in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D351B51CED100929105 /* IncorrectHeaders.zip */; }; - A5D15D3E1B51CED100929105 /* PermissionsTestApp.app in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D361B51CED100929105 /* PermissionsTestApp.app */; }; - A5D15D3F1B51CED100929105 /* RelativeSymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D371B51CED100929105 /* RelativeSymbolicLink.zip */; }; - A5D15D401B51CED100929105 /* SymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D381B51CED100929105 /* SymbolicLink.zip */; }; - A5D15D411B51CED100929105 /* TestArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D391B51CED100929105 /* TestArchive.zip */; }; - A5D15D421B51CED100929105 /* TestPasswordArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D3A1B51CED100929105 /* TestPasswordArchive.zip */; }; - A5D15D431B51CED100929105 /* Unicode.zip in Resources */ = {isa = PBXBuildFile; fileRef = A5D15D3B1B51CED100929105 /* Unicode.zip */; }; - A5D15D441B51CF2900929105 /* Main.m in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D191B51A4D000929105 /* Main.m */; }; - A5D15D451B51D64200929105 /* Main.m in Headers */ = {isa = PBXBuildFile; fileRef = A5D15D191B51A4D000929105 /* Main.m */; }; - A5D15D461B51D68600929105 /* CollectingDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A5D15D1E1B51CD5600929105 /* CollectingDelegate.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - A5D15CCA1B51A38C00929105 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = A5D15CB41B51A38C00929105 /* Project object */; - proxyType = 1; - remoteGlobalIDString = A5D15CBC1B51A38C00929105; - remoteInfo = ZipArchive; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - A527EDD31B52806D00CA3DAF /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; - A527EDD51B52808400CA3DAF /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - A527EDD71B52808900CA3DAF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - A5D15CBD1B51A38C00929105 /* ZipArchive.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - A5D15CC11B51A38C00929105 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A5D15CC21B51A38C00929105 /* ZipArchive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZipArchive.h; sourceTree = ""; }; - A5D15CC81B51A38C00929105 /* ZipArchiveTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ZipArchiveTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - A5D15CCE1B51A38C00929105 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A5D15CCF1B51A38C00929105 /* ZipArchiveTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZipArchiveTests.m; sourceTree = ""; }; - A5D15CDD1B51A3A400929105 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; - A5D15CE01B51A3A400929105 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A5D15CE11B51A3A400929105 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - A5D15CE31B51A3A400929105 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - A5D15CE41B51A3A400929105 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - A5D15CE61B51A3A400929105 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - A5D15CE71B51A3A400929105 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - A5D15CEA1B51A3A400929105 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - A5D15CEC1B51A3A400929105 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - A5D15CEF1B51A3A400929105 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - A5D15D051B51A44C00929105 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = crypt.h; path = minizip/crypt.h; sourceTree = ""; }; - A5D15D061B51A44C00929105 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ioapi.c; path = minizip/ioapi.c; sourceTree = ""; }; - A5D15D071B51A44C00929105 /* ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ioapi.h; path = minizip/ioapi.h; sourceTree = ""; }; - A5D15D081B51A44C00929105 /* mztools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mztools.c; path = minizip/mztools.c; sourceTree = ""; }; - A5D15D091B51A44C00929105 /* mztools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mztools.h; path = minizip/mztools.h; sourceTree = ""; }; - A5D15D0A1B51A44C00929105 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = unzip.c; path = minizip/unzip.c; sourceTree = ""; }; - A5D15D0B1B51A44C00929105 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = unzip.h; path = minizip/unzip.h; sourceTree = ""; }; - A5D15D0C1B51A44C00929105 /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip.c; path = minizip/zip.c; sourceTree = ""; }; - A5D15D0D1B51A44C00929105 /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zip.h; path = minizip/zip.h; sourceTree = ""; }; - A5D15D181B51A4D000929105 /* Main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Main.h; sourceTree = ""; }; - A5D15D191B51A4D000929105 /* Main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Main.m; sourceTree = ""; }; - A5D15D1C1B51CD4C00929105 /* CollectingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectingDelegate.h; sourceTree = ""; }; - A5D15D1E1B51CD5600929105 /* CollectingDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CollectingDelegate.m; sourceTree = ""; }; - A5D15D231B51CEAC00929105 /* 0.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 0.m4a; path = Multi_Zip_Test/0.m4a; sourceTree = ""; }; - A5D15D241B51CEAC00929105 /* 1.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 1.m4a; path = Multi_Zip_Test/1.m4a; sourceTree = ""; }; - A5D15D251B51CEAC00929105 /* 2.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 2.m4a; path = Multi_Zip_Test/2.m4a; sourceTree = ""; }; - A5D15D261B51CEAC00929105 /* 3.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 3.m4a; path = Multi_Zip_Test/3.m4a; sourceTree = ""; }; - A5D15D271B51CEAC00929105 /* 4.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 4.m4a; path = Multi_Zip_Test/4.m4a; sourceTree = ""; }; - A5D15D281B51CEAC00929105 /* 5.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 5.m4a; path = Multi_Zip_Test/5.m4a; sourceTree = ""; }; - A5D15D291B51CEAC00929105 /* 6.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 6.m4a; path = Multi_Zip_Test/6.m4a; sourceTree = ""; }; - A5D15D2A1B51CEAC00929105 /* 7.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 7.m4a; path = Multi_Zip_Test/7.m4a; sourceTree = ""; }; - A5D15D341B51CED100929105 /* hello.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = hello.zip; path = Fixtures/hello.zip; sourceTree = ""; }; - A5D15D351B51CED100929105 /* IncorrectHeaders.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = IncorrectHeaders.zip; path = Fixtures/IncorrectHeaders.zip; sourceTree = ""; }; - A5D15D361B51CED100929105 /* PermissionsTestApp.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; name = PermissionsTestApp.app; path = Fixtures/PermissionsTestApp.app; sourceTree = ""; }; - A5D15D371B51CED100929105 /* RelativeSymbolicLink.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = RelativeSymbolicLink.zip; path = Fixtures/RelativeSymbolicLink.zip; sourceTree = ""; }; - A5D15D381B51CED100929105 /* SymbolicLink.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = SymbolicLink.zip; path = Fixtures/SymbolicLink.zip; sourceTree = ""; }; - A5D15D391B51CED100929105 /* TestArchive.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = TestArchive.zip; path = Fixtures/TestArchive.zip; sourceTree = ""; }; - A5D15D3A1B51CED100929105 /* TestPasswordArchive.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = TestPasswordArchive.zip; path = Fixtures/TestPasswordArchive.zip; sourceTree = ""; }; - A5D15D3B1B51CED100929105 /* Unicode.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; name = Unicode.zip; path = Fixtures/Unicode.zip; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - A5D15CB91B51A38C00929105 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - A527EDD91B52809700CA3DAF /* Foundation.framework in Frameworks */, - A527EDDA1B52809700CA3DAF /* CoreGraphics.framework in Frameworks */, - A527EDD41B52806D00CA3DAF /* libz.dylib in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A5D15CC51B51A38C00929105 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - A53101831B528EE100FA26EA /* ZipArchive.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A5D15CDA1B51A3A400929105 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - A527EDDB1B5280D600CA3DAF /* Frameworks */ = { - isa = PBXGroup; - children = ( - A527EDD71B52808900CA3DAF /* Foundation.framework */, - A527EDD51B52808400CA3DAF /* CoreGraphics.framework */, - A527EDD31B52806D00CA3DAF /* libz.dylib */, - ); - name = Frameworks; - path = ZipArchive; - sourceTree = ""; - }; - A5D15CB31B51A38C00929105 = { - isa = PBXGroup; - children = ( - A5D15CBF1B51A38C00929105 /* ZipArchive */, - A5D15CCC1B51A38C00929105 /* ZipArchiveTests */, - A5D15CDE1B51A3A400929105 /* Example */, - A527EDDB1B5280D600CA3DAF /* Frameworks */, - A5D15CBE1B51A38C00929105 /* Products */, - ); - sourceTree = ""; - }; - A5D15CBE1B51A38C00929105 /* Products */ = { - isa = PBXGroup; - children = ( - A5D15CBD1B51A38C00929105 /* ZipArchive.framework */, - A5D15CC81B51A38C00929105 /* ZipArchiveTests.xctest */, - A5D15CDD1B51A3A400929105 /* Example.app */, - ); - name = Products; - sourceTree = ""; - }; - A5D15CBF1B51A38C00929105 /* ZipArchive */ = { - isa = PBXGroup; - children = ( - A5D15CC21B51A38C00929105 /* ZipArchive.h */, - A5D15D181B51A4D000929105 /* Main.h */, - A5D15D191B51A4D000929105 /* Main.m */, - A5D15CC01B51A38C00929105 /* Supporting Files */, - ); - path = ZipArchive; - sourceTree = ""; - }; - A5D15CC01B51A38C00929105 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - A5D15D171B51A46A00929105 /* minizip */, - A5D15CC11B51A38C00929105 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - A5D15CCC1B51A38C00929105 /* ZipArchiveTests */ = { - isa = PBXGroup; - children = ( - A5D15CCF1B51A38C00929105 /* ZipArchiveTests.m */, - A5D15D331B51CEBD00929105 /* Fixtures */, - A5D15D221B51CEA300929105 /* Multi_Zip_Test */, - A5D15D1C1B51CD4C00929105 /* CollectingDelegate.h */, - A5D15D1E1B51CD5600929105 /* CollectingDelegate.m */, - A5D15CCD1B51A38C00929105 /* Supporting Files */, - ); - path = ZipArchiveTests; - sourceTree = ""; - }; - A5D15CCD1B51A38C00929105 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - A5D15CCE1B51A38C00929105 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - A5D15CDE1B51A3A400929105 /* Example */ = { - isa = PBXGroup; - children = ( - A5D15CE61B51A3A400929105 /* ViewController.h */, - A5D15CE71B51A3A400929105 /* ViewController.m */, - A5D15CE91B51A3A400929105 /* Main.storyboard */, - A5D15CDF1B51A3A400929105 /* Supporting Files */, - ); - path = Example; - sourceTree = ""; - }; - A5D15CDF1B51A3A400929105 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - A5D15CE31B51A3A400929105 /* AppDelegate.h */, - A5D15CE41B51A3A400929105 /* AppDelegate.m */, - A5D15CEC1B51A3A400929105 /* Images.xcassets */, - A5D15CEE1B51A3A400929105 /* LaunchScreen.xib */, - A5D15CE01B51A3A400929105 /* Info.plist */, - A5D15CE11B51A3A400929105 /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - A5D15D171B51A46A00929105 /* minizip */ = { - isa = PBXGroup; - children = ( - A5D15D051B51A44C00929105 /* crypt.h */, - A5D15D061B51A44C00929105 /* ioapi.c */, - A5D15D071B51A44C00929105 /* ioapi.h */, - A5D15D081B51A44C00929105 /* mztools.c */, - A5D15D091B51A44C00929105 /* mztools.h */, - A5D15D0A1B51A44C00929105 /* unzip.c */, - A5D15D0B1B51A44C00929105 /* unzip.h */, - A5D15D0C1B51A44C00929105 /* zip.c */, - A5D15D0D1B51A44C00929105 /* zip.h */, - ); - name = minizip; - sourceTree = ""; - }; - A5D15D221B51CEA300929105 /* Multi_Zip_Test */ = { - isa = PBXGroup; - children = ( - A5D15D231B51CEAC00929105 /* 0.m4a */, - A5D15D241B51CEAC00929105 /* 1.m4a */, - A5D15D251B51CEAC00929105 /* 2.m4a */, - A5D15D261B51CEAC00929105 /* 3.m4a */, - A5D15D271B51CEAC00929105 /* 4.m4a */, - A5D15D281B51CEAC00929105 /* 5.m4a */, - A5D15D291B51CEAC00929105 /* 6.m4a */, - A5D15D2A1B51CEAC00929105 /* 7.m4a */, - ); - name = Multi_Zip_Test; - sourceTree = ""; - }; - A5D15D331B51CEBD00929105 /* Fixtures */ = { - isa = PBXGroup; - children = ( - A5D15D341B51CED100929105 /* hello.zip */, - A5D15D351B51CED100929105 /* IncorrectHeaders.zip */, - A5D15D361B51CED100929105 /* PermissionsTestApp.app */, - A5D15D371B51CED100929105 /* RelativeSymbolicLink.zip */, - A5D15D381B51CED100929105 /* SymbolicLink.zip */, - A5D15D391B51CED100929105 /* TestArchive.zip */, - A5D15D3A1B51CED100929105 /* TestPasswordArchive.zip */, - A5D15D3B1B51CED100929105 /* Unicode.zip */, - ); - name = Fixtures; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - A5D15CBA1B51A38C00929105 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - A5D15CC31B51A38C00929105 /* ZipArchive.h in Headers */, - A53101811B5284E200FA26EA /* Main.h in Headers */, - A527EDC11B527FD000CA3DAF /* crypt.h in Headers */, - A527EDC21B527FD000CA3DAF /* ioapi.c in Headers */, - A527EDC31B527FD000CA3DAF /* ioapi.h in Headers */, - A527EDC41B527FD000CA3DAF /* mztools.c in Headers */, - A527EDC51B527FD000CA3DAF /* mztools.h in Headers */, - A527EDC61B527FD000CA3DAF /* unzip.c in Headers */, - A527EDC71B527FD000CA3DAF /* unzip.h in Headers */, - A527EDC81B527FD000CA3DAF /* zip.c in Headers */, - A527EDC91B527FD000CA3DAF /* zip.h in Headers */, - A5D15D451B51D64200929105 /* Main.m in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - A5D15CBC1B51A38C00929105 /* ZipArchive */ = { - isa = PBXNativeTarget; - buildConfigurationList = A5D15CD31B51A38C00929105 /* Build configuration list for PBXNativeTarget "ZipArchive" */; - buildPhases = ( - A5D15CB81B51A38C00929105 /* Sources */, - A5D15CB91B51A38C00929105 /* Frameworks */, - A5D15CBA1B51A38C00929105 /* Headers */, - A5D15CBB1B51A38C00929105 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ZipArchive; - productName = ZipArchive; - productReference = A5D15CBD1B51A38C00929105 /* ZipArchive.framework */; - productType = "com.apple.product-type.framework"; - }; - A5D15CC71B51A38C00929105 /* ZipArchiveTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = A5D15CD61B51A38C00929105 /* Build configuration list for PBXNativeTarget "ZipArchiveTests" */; - buildPhases = ( - A5D15CC41B51A38C00929105 /* Sources */, - A5D15CC51B51A38C00929105 /* Frameworks */, - A5D15CC61B51A38C00929105 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - A5D15CCB1B51A38C00929105 /* PBXTargetDependency */, - ); - name = ZipArchiveTests; - productName = ZipArchiveTests; - productReference = A5D15CC81B51A38C00929105 /* ZipArchiveTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - A5D15CDC1B51A3A400929105 /* Example */ = { - isa = PBXNativeTarget; - buildConfigurationList = A5D15CFD1B51A3A400929105 /* Build configuration list for PBXNativeTarget "Example" */; - buildPhases = ( - A5D15CD91B51A3A400929105 /* Sources */, - A5D15CDA1B51A3A400929105 /* Frameworks */, - A5D15CDB1B51A3A400929105 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Example; - productName = Example; - productReference = A5D15CDD1B51A3A400929105 /* Example.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - A5D15CB41B51A38C00929105 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0640; - ORGANIZATIONNAME = "Cosmic Labs"; - TargetAttributes = { - A5D15CBC1B51A38C00929105 = { - CreatedOnToolsVersion = 6.4; - }; - A5D15CC71B51A38C00929105 = { - CreatedOnToolsVersion = 6.4; - }; - A5D15CDC1B51A3A400929105 = { - CreatedOnToolsVersion = 6.4; - }; - }; - }; - buildConfigurationList = A5D15CB71B51A38C00929105 /* Build configuration list for PBXProject "ZipArchive" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = A5D15CB31B51A38C00929105; - productRefGroup = A5D15CBE1B51A38C00929105 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - A5D15CBC1B51A38C00929105 /* ZipArchive */, - A5D15CC71B51A38C00929105 /* ZipArchiveTests */, - A5D15CDC1B51A3A400929105 /* Example */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - A5D15CBB1B51A38C00929105 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A5D15CC61B51A38C00929105 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - A5D15D311B51CEAC00929105 /* 6.m4a in Resources */, - A5D15D3F1B51CED100929105 /* RelativeSymbolicLink.zip in Resources */, - A5D15D401B51CED100929105 /* SymbolicLink.zip in Resources */, - A5D15D431B51CED100929105 /* Unicode.zip in Resources */, - A5D15D3C1B51CED100929105 /* hello.zip in Resources */, - A5D15D301B51CEAC00929105 /* 5.m4a in Resources */, - A5D15D421B51CED100929105 /* TestPasswordArchive.zip in Resources */, - A5D15D2E1B51CEAC00929105 /* 3.m4a in Resources */, - A5D15D3D1B51CED100929105 /* IncorrectHeaders.zip in Resources */, - A5D15D2F1B51CEAC00929105 /* 4.m4a in Resources */, - A5D15D411B51CED100929105 /* TestArchive.zip in Resources */, - A5D15D321B51CEAC00929105 /* 7.m4a in Resources */, - A5D15D2D1B51CEAC00929105 /* 2.m4a in Resources */, - A5D15D2C1B51CEAC00929105 /* 1.m4a in Resources */, - A5D15D3E1B51CED100929105 /* PermissionsTestApp.app in Resources */, - A5D15D2B1B51CEAC00929105 /* 0.m4a in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A5D15CDB1B51A3A400929105 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - A5D15CEB1B51A3A400929105 /* Main.storyboard in Resources */, - A5D15CF01B51A3A400929105 /* LaunchScreen.xib in Resources */, - A5D15CED1B51A3A400929105 /* Images.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - A5D15CB81B51A38C00929105 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - A5D15D1B1B51A4D000929105 /* Main.m in Sources */, - A527EDCA1B52804E00CA3DAF /* crypt.h in Sources */, - A527EDCB1B52804E00CA3DAF /* ioapi.c in Sources */, - A527EDCC1B52804E00CA3DAF /* ioapi.h in Sources */, - A527EDCD1B52804E00CA3DAF /* mztools.c in Sources */, - A527EDCE1B52804E00CA3DAF /* mztools.h in Sources */, - A527EDCF1B52804E00CA3DAF /* unzip.c in Sources */, - A527EDD01B52804E00CA3DAF /* unzip.h in Sources */, - A527EDD11B52804E00CA3DAF /* zip.c in Sources */, - A527EDD21B52804E00CA3DAF /* zip.h in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A5D15CC41B51A38C00929105 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - A53101841B528EF200FA26EA /* ZipArchiveTests.m in Sources */, - A5D15D441B51CF2900929105 /* Main.m in Sources */, - A5D15D461B51D68600929105 /* CollectingDelegate.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A5D15CD91B51A3A400929105 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - A5D15CE81B51A3A400929105 /* ViewController.m in Sources */, - A5D15CE51B51A3A400929105 /* AppDelegate.m in Sources */, - A5D15CE21B51A3A400929105 /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - A5D15CCB1B51A38C00929105 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = A5D15CBC1B51A38C00929105 /* ZipArchive */; - targetProxy = A5D15CCA1B51A38C00929105 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - A5D15CE91B51A3A400929105 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - A5D15CEA1B51A3A400929105 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - A5D15CEE1B51A3A400929105 /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - A5D15CEF1B51A3A400929105 /* Base */, - ); - name = LaunchScreen.xib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - A5D15CD11B51A38C00929105 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - A5D15CD21B51A38C00929105 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - A5D15CD41B51A38C00929105 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = ZipArchive/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - A5D15CD51B51A38C00929105 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = ZipArchive/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Release; - }; - A5D15CD71B51A38C00929105 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = ZipArchiveTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - A5D15CD81B51A38C00929105 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = ZipArchiveTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - A5D15CFE1B51A3A400929105 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Example/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - A5D15CFF1B51A3A400929105 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = Example/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - A5D15CB71B51A38C00929105 /* Build configuration list for PBXProject "ZipArchive" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A5D15CD11B51A38C00929105 /* Debug */, - A5D15CD21B51A38C00929105 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - A5D15CD31B51A38C00929105 /* Build configuration list for PBXNativeTarget "ZipArchive" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A5D15CD41B51A38C00929105 /* Debug */, - A5D15CD51B51A38C00929105 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - A5D15CD61B51A38C00929105 /* Build configuration list for PBXNativeTarget "ZipArchiveTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A5D15CD71B51A38C00929105 /* Debug */, - A5D15CD81B51A38C00929105 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - A5D15CFD1B51A3A400929105 /* Build configuration list for PBXNativeTarget "Example" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A5D15CFE1B51A3A400929105 /* Debug */, - A5D15CFF1B51A3A400929105 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = A5D15CB41B51A38C00929105 /* Project object */; -} diff --git a/ZipArchive.xcodeproj/xcshareddata/xcschemes/ZipArchive.xcscheme b/ZipArchive.xcodeproj/xcshareddata/xcschemes/ZipArchive.xcscheme deleted file mode 100644 index 06c0d2c..0000000 --- a/ZipArchive.xcodeproj/xcshareddata/xcschemes/ZipArchive.xcscheme +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ZipArchive/Main.h b/ZipArchive/Main.h deleted file mode 100644 index ecbbcdb..0000000 --- a/ZipArchive/Main.h +++ /dev/null @@ -1,112 +0,0 @@ -// -// Main.h -// ZipArchive -// -// Originally Created by Sam Soffes on 2010-07-21. -// Copyright (c) 2015 ZipArchive. All rights reserved. -// - -#ifndef _ZIPARCHIVE_H -#define _ZIPARCHIVE_H - -#import -#include "unzip.h" - -@protocol ZipArchiveDelegate; - -@interface Main: NSObject - -// Unzip -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - delegate:(id) delegate; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(NSString *)password - error:(NSError *)error; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(NSString *)password - error:(NSError *)error - delegate:(id)delegate; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(NSString *)password - error:(NSError *)error - delegate:(id)delegate - progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler; - -// Zip -+ (BOOL)createZipFileAtPath:(NSString *)path - withFilesAtPaths:(NSArray *)paths; - -+ (BOOL)createZipFileAtPath:(NSString *)path - withContentsOfDirectory:(NSString *)directoryPath; - -+ (BOOL)createZipFileAtPath:(NSString *)path - withContentsOfDirectory:(NSString *)directoryPath - keepParentDirectory:(BOOL)keepParentDirectory; - -- (instancetype)initWithPath:(NSString *)path NS_DESIGNATED_INITIALIZER; - -@property (NS_NONATOMIC_IOSONLY, readonly) BOOL open; -@property (NS_NONATOMIC_IOSONLY, readonly) BOOL close; - -@end - -@protocol ZipArchiveDelegate -@optional - -- (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path - zipInformation:(unz_global_info)zipInformation; - -- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path - zipInformation:(unz_global_info)zipInformation - unzippedPath:(NSString *)unzippedPath; - -- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex - totalFiles:(NSInteger)totalFiles - archivePath: (NSString *)archivePath - fileInformation:(unz_file_info)fileInformation; - -- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex - totalFiles:(NSInteger)totalFiles - archivePath:(NSString *)archivePath - fileInformation:(unz_file_info)fileInformation; - -- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex - totalFiles:(NSInteger)totalFiles - archivePath:(NSString *)archivePath - fileInformation:(unz_file_info)fileInformation; - -- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex - totalFiles:(NSInteger)totalFiles - archivePath:(NSString *)archivePath - unzippedFilePath:(NSString *)unzippedFilePath; - -- (void)zipArchiveProgressEvent:(unsigned long long)loaded - total:(unsigned long long)total; - -- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile - entryPath:(NSString *)entryPath - destinationPath:(NSString *)destinationPath; - -@end - - -#endif /* _ZIPARCHIVE_H */ diff --git a/ZipArchive/Main.m b/ZipArchive/Main.m deleted file mode 100644 index 720c28c..0000000 --- a/ZipArchive/Main.m +++ /dev/null @@ -1,702 +0,0 @@ -// -// Main.m -// ZipArchive -// -// Originally Created by Sam Soffes on 2010-07-21. -// Copyright (c) 2015 ZipArchive. All rights reserved. -// - -#import "Main.h" -#import "zip.h" -#import "zlib.h" -#import "zconf.h" -#include - -#define CHUNK 16384 - -@interface Main () - -+ (NSDate *)dateWithMicrosoftDOSFormat:(UInt32)microsoftDOSDateTime; - -@end - - -@implementation Main { - NSString *_path; - NSString *_fileName; - zipFile _zip; -} - -#pragma mark - Unzipping -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination { - - return [self unzipFileAtPath:path - toDestination:destination - delegate:nil]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(NSString *)password - error:(NSError *)error { - - return [self unzipFileAtPath:path - toDestination:destination - overwrite:overwrite - password:password - error:error - delegate:nil - progressHandler:nil - completionHandler:nil]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - delegate:(id)delegate { - - return [self unzipFileAtPath:path - toDestination:destination - overwrite:YES - password:nil - error:nil - delegate:delegate - progressHandler:nil - completionHandler:nil]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(NSString *)password - error:(NSError *)error - delegate:(id)delegate { - - return [self unzipFileAtPath:path - toDestination:destination - overwrite:overwrite - password:password - error:error - delegate:delegate - progressHandler:nil - completionHandler:nil]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(NSString *)password - progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler { - - return [self unzipFileAtPath:path - toDestination:destination - overwrite:overwrite - password:password - error:nil - delegate:nil - progressHandler:progressHandler - completionHandler:completionHandler]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler { - - return [self unzipFileAtPath:path - toDestination:destination - overwrite:YES - password:nil - error:nil - delegate:nil - progressHandler:progressHandler - completionHandler:completionHandler]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(NSString *)password - error:(NSError *)error - delegate:(id)delegate - progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler { - - // Prepare Unzip Operations - zipFile zip = unzOpen((const char*)[path UTF8String]); - - if (NULL == zip) { - NSDictionary *userInformation = @{NSLocalizedDescriptionKey: @"Failed to unzip file"}; - NSError *err = [NSError errorWithDomain:@"ZipArchiveErrorDomain" code:-1 userInfo:userInformation]; - - if (error) { - error = err; - } - - if (completionHandler) { - completionHandler(nil, NO, err); - } - - return NO; - } - - NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil]; - unsigned long long fileSize = [fileAttributes[NSFileSize] unsignedLongLongValue]; - unsigned long long currentPosition = 0; - - unz_global_info globalInfo = {0ul, 0ul}; - unzGetGlobalInfo(zip, &globalInfo); - - // Begin Unzip Operations - - if (UNZ_OK != unzGoToFirstFile(zip)) { - NSDictionary *userInformation = @{NSLocalizedDescriptionKey: @"Failed to open the first file in Zip."}; - NSError *err = [NSError errorWithDomain:@"ZipArchiveErrorDomain" code:-2 userInfo:userInformation]; - - if (error) { - error = err; - } - - if (completionHandler) { - completionHandler(nil, NO, err); - } - - return NO; - } - - NSFileManager *fileManager = [NSFileManager defaultManager]; - NSMutableSet *directoriesModificationDates = [[NSMutableSet alloc] init]; - - BOOL success = YES; - BOOL canceled = NO; - - int ret = 0; - unsigned char buffer[4096] = {0}; - - // Message Delegate - if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipArchiveAtPath:zipInformation:)]) { - [delegate zipArchiveWillUnzipArchiveAtPath:path - zipInformation:globalInfo]; - } - - if ([delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { - [delegate zipArchiveProgressEvent:(NSInteger)currentPosition - total:(NSInteger)fileSize]; - } - - NSInteger currentFileNumber = 0; - - do { - @autoreleasepool { - if (0 == [password length]) { - ret = unzOpenCurrentFile(zip); - } else { - ret = unzOpenCurrentFilePassword(zip, [password cStringUsingEncoding:NSASCIIStringEncoding]); - } - - if (UNZ_OK != ret) { - success = NO; - - break; - } - - // Reading data and write to file - unz_file_info fileInfo; - memset(&fileInfo, 0, sizeof(unz_file_info)); - ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0); - - if (UNZ_OK != ret) { - success = NO; - unzCloseCurrentFile(zip); - - break; - } - - currentPosition += fileInfo.compressed_size; - - // Message Delegate - if ([delegate respondsToSelector:@selector(zipArchiveShouldUnzipFileAtIndex:totalFiles:archivePath:fileInformation:)]) { - - if (![delegate zipArchiveShouldUnzipFileAtIndex:currentFileNumber - totalFiles:(NSInteger)globalInfo.number_entry - archivePath:path - fileInformation:fileInfo]) { - success = NO; - canceled = YES; - } - } - - if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipFileAtIndex:totalFiles:archivePath:fileInformation:)]) { - [delegate zipArchiveWillUnzipFileAtIndex:currentFileNumber - totalFiles:(NSInteger)globalInfo.number_entry - archivePath:path - fileInformation:fileInfo]; - } - - if ([delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { - [delegate zipArchiveProgressEvent:(NSInteger)currentPosition - total:(NSInteger)fileSize]; - } - - char *filename = (char *)malloc(fileInfo.size_filename + 1); - unzGetCurrentFileInfo(zip, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); - filename[fileInfo.size_filename] = '\0'; - - // NOTES: - http://pastebin.com/h7NwsLDA - const uLong ZipUNIXVersion = 3; - const uLong BSD_SFMT = 0170000; - const uLong BSD_IFLNK = 0120000; - - BOOL fileIsSymbolicLink = NO; - if (((fileInfo.version >> 8) == ZipUNIXVersion) && BSD_IFLNK == (BSD_SFMT & (fileInfo.external_fa >> 16))) { - fileIsSymbolicLink = NO; - } - - // Check if zip contains any directories - NSString *strPath = @(filename); - BOOL isDirectory = NO; - - if (filename[fileInfo.size_filename-1] == '/' || filename[fileInfo.size_filename-1] == '\\') { - isDirectory = YES; - } - - free(filename); - - // Check if zip contains any paths - if ([strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location != NSNotFound) { - strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; - } - - NSString *fullPath = [destination stringByAppendingPathComponent:strPath]; - NSError *err = nil; - NSDate *modDate = [[self class] dateWithMicrosoftDOSFormat:(UInt32)fileInfo.dosDate]; - NSDictionary *directoryAttr = @{NSFileCreationDate: modDate, NSFileModificationDate: modDate}; - - if (isDirectory) { - [fileManager createDirectoryAtPath:fullPath - withIntermediateDirectories:YES - attributes:directoryAttr - error:&err]; - } else { - [fileManager createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] - withIntermediateDirectories:YES - attributes:directoryAttr - error:&err]; - } - - if (nil != err) { - NSLog(@"ZipArchive Error: %@", err.localizedDescription); - } - - if(!fileIsSymbolicLink) - [directoriesModificationDates addObject: @{@"path": fullPath, @"modDate": modDate}]; - - if ([fileManager fileExistsAtPath:fullPath] && !isDirectory && !overwrite) { - unzCloseCurrentFile(zip); - ret = unzGoToNextFile(zip); - - continue; - } - - if (!fileIsSymbolicLink) { - FILE *fp = fopen((const char*)[fullPath UTF8String], "wb"); - - while (fp) { - int readBytes = unzReadCurrentFile(zip, buffer, 4096); - - if (readBytes > 0) { - fwrite(buffer, readBytes, 1, fp ); - } else { - break; - } - } - - if (fp) { - if ([[[fullPath pathExtension] lowercaseString] isEqualToString:@"zip"]) { - NSLog(@"Unzipping nested .zip file: %@", [fullPath lastPathComponent]); - - if ([self unzipFileAtPath:fullPath - toDestination:[fullPath stringByDeletingLastPathComponent] - overwrite:overwrite - password:password - error:nil - delegate:nil]) { - - [[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil]; - } - } - - fclose(fp); - - // Set the original date/time property - if (0 != fileInfo.dosDate) { - NSDate *originalDate = [[self class] dateWithMicrosoftDOSFormat:(UInt32)fileInfo.dosDate]; - NSDictionary *attributes = @{NSFileModificationDate: originalDate}; - - if (attributes) { - if (NO == [fileManager setAttributes:attributes - ofItemAtPath:fullPath error:nil]) { - // Can't set attributes - NSLog(@"[ZipArchive] Failed to set attributes - whilst setting modification date"); - } - } - } - - // Set the original permissions on the file - uLong permissions = fileInfo.external_fa >> 16; - if (0 != permissions) { - // Store it into a NSNumber - NSNumber *permissionsValue = @(permissions); - - // Retrieve any existing attributes - NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithDictionary:[fileManager attributesOfItemAtPath:fullPath error:nil]]; - - // Set the value in the attributes dict - attributes[NSFilePosixPermissions] = permissionsValue; - - // Update attributes - if (NO == [fileManager setAttributes:attributes - ofItemAtPath:fullPath error:nil]) { - // Unable to set the permissions attribute - NSLog(@"[ZipArchive] Failed to set attributes - whilst setting permissions"); - } - } - } - } 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); - } - } - - unzCloseCurrentFile( zip ); - ret = unzGoToNextFile( zip ); - - // Message Delegate - if ([delegate respondsToSelector:@selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:fileInformation:)]) { - [delegate zipArchiveDidUnzipFileAtIndex:currentFileNumber - totalFiles:(NSInteger)globalInfo.number_entry - archivePath:path - fileInformation: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); - 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 *dictionary in directoriesModificationDates) { - if (![[NSFileManager defaultManager] setAttributes:@{NSFileModificationDate: dictionary[@"modDate"]} - ofItemAtPath:dictionary[@"path"] - error:&err]) { - NSLog(@"[ZipArchive] Set attributes failed for directory: %@.", dictionary[@"path"]); - } - if (err) { - NSLog(@"[ZipArchive] Error setting directory file modification date attribute: %@", err.localizedDescription); - } - } - - // Message Delegate - if (success && [delegate respondsToSelector:@selector(zipArchiveDidUnzipArchiveAtPath:zipInformation:unzippedPath:)]) { - [delegate zipArchiveDidUnzipArchiveAtPath:path zipInformation:globalInfo unzippedPath:destination]; - } - - // final progress event = 100% - if (!canceled && [delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { - [delegate zipArchiveProgressEvent:fileSize total:fileSize]; - } - - if (completionHandler) { - completionHandler(path, YES, nil); - } - - return success; -} - -#pragma mark - Zipping -+ (BOOL)createZipFileAtPath:(NSString *)path - withFilesAtPaths:(NSArray *)paths { - BOOL success = NO; - Main *zipArchive = [[Main alloc] initWithPath:path]; - - if ([zipArchive open]) { - for (NSString *filePath in paths) { - [zipArchive writeFile:filePath]; - } - - success = [zipArchive close]; - } - - return success; -} - -+ (BOOL)createZipFileAtPath:(NSString *)path - withContentsOfDirectory:(NSString *)directoryPath { - return [self createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:NO]; -} - -+ (BOOL)createZipFileAtPath:(NSString *)path - withContentsOfDirectory:(NSString *)directoryPath - keepParentDirectory:(BOOL)keepParentDirectory { - BOOL success = NO; - NSFileManager *fileManager = nil; - Main *zipArchive = [[Main alloc] initWithPath:path]; - - if ([zipArchive open]) { - // Use a local file manager (queue/thread compatibility) - fileManager = [[NSFileManager alloc] init]; - - NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtPath:directoryPath]; - NSString *fileName; - - while ((fileName = [directoryEnumerator nextObject])) { - BOOL isDirectory; - NSString *fullFilePath = [directoryPath stringByAppendingPathComponent:fileName]; - [fileManager fileExistsAtPath:fullFilePath isDirectory:&isDirectory]; - - if (!isDirectory) { - if (keepParentDirectory) { - fileName = [[directoryPath lastPathComponent] stringByAppendingPathComponent:fileName]; - } - - [zipArchive writeFileAtPath:fullFilePath withFileName:fileName]; - } else { - if (0 == [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:fullFilePath error:nil].count) { - NSString *temporaryName = [fullFilePath stringByAppendingPathComponent:@".DS_Store"]; - [@"" writeToFile:temporaryName atomically:YES encoding:NSUTF8StringEncoding error:nil]; - [zipArchive writeFileAtPath:temporaryName withFileName:[fileName stringByAppendingPathComponent:@".DS_Store"]]; - [[NSFileManager defaultManager] removeItemAtPath:temporaryName error:nil]; - } - } - } - - success = [zipArchive close]; - } - - return success; -} - -- (instancetype)initWithPath:(NSString *)path { - if ((self = [super init])) { - _path = [path copy]; - } - - return self; -} - -- (BOOL)open { - NSAssert((NULL == _zip), @"Attempting to open an archive which has already been opened."); - _zip = zipOpen([_path UTF8String], APPEND_STATUS_CREATE); - - return (NULL != _zip); -} - -- (void)zipInformation:(zip_fileinfo *)zipInformation setDate:(NSDate *)date { - NSCalendar *currentCalendar = [NSCalendar currentCalendar]; - -#if defined(__IPHONE_8_0) || defined(__MAC_10_10) - uint flags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; -#else - uint flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit; -#endif - - NSDateComponents *components = [currentCalendar components:flags fromDate:date]; - zipInformation -> tmz_date.tm_sec = (unsigned int)components.second; - zipInformation -> tmz_date.tm_min = (unsigned int)components.minute; - zipInformation -> tmz_date.tm_hour = (unsigned int)components.hour; - zipInformation -> tmz_date.tm_mday = (unsigned int)components.day; - zipInformation -> tmz_date.tm_mon = (unsigned int)components.month - 1; - zipInformation -> tmz_date.tm_year = (unsigned int)components.year; -} - -- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName { - NSAssert((NULL != _zip), @"Attempting to write to an archive which has not been unzipped."); - zip_fileinfo zipInformation = {{0}}; - NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil]; - - if (attributes) { - NSDate *fileDate = (NSDate *)attributes[NSFileModificationDate]; - - if (fileDate) { - [self zipInformation:&zipInformation setDate:fileDate]; - } - - // Write permissions into the external attributes. See: http://unix.stackexchange.com/a/14727 - // Get the permissions value from the files attributes - NSNumber *permissionsValue = (NSNumber *)attributes[NSFilePosixPermissions]; - - if (permissionsValue) { - // Short -> Octal -> Long - short permissionsShort = permissionsValue.shortValue; - NSInteger permissionsOctal = 0100000 + permissionsShort; - uLong permissionsLong = @(permissionsOctal).unsignedLongValue; - zipInformation.external_fa = permissionsLong < 16L; - } - } - - unsigned int len = 0; - zipOpenNewFileInZip(_zip, [[folderName stringByAppendingString:@"/"] UTF8String], &zipInformation, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_NO_COMPRESSION); - zipWriteInFileInZip(_zip, &len, 0); - zipCloseFileInZip(_zip); - - return YES; -} - -- (BOOL)writeFile:(NSString *)path { - return [self writeFileAtPath:path withFileName:nil]; -} - -// Supports writing files with logical folder/directory structure -// `path` is the absolute path of teh file that will be compressed -// `fileName` is the relative name of the file and how it is stored within the zip (IE: /folder/subfolder/foo.txt) -- (BOOL)writeFileAtPath:(NSString *)path withFileName:(NSString *)fileName { - NSAssert((NULL != _zip), @"Attempting to write to an archive which was never unzipped."); - FILE *input = fopen([path UTF8String], "r"); - - if (NULL == input) { - return NO; - } - - const char *aFileName; - if (!fileName) { - aFileName = [path.lastPathComponent UTF8String]; - } else { - aFileName = [fileName UTF8String]; - } - - zip_fileinfo zipInformation = {{0}}; - NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil]; - - if (attributes) { - NSDate *fileDate = (NSDate *)attributes[NSFileModificationDate]; - - if (fileDate) { - [self zipInformation:&zipInformation setDate:fileDate]; - } - - // Write permissions into the external attributes. See: http://unix.stackexchange.com/a/14727 - // Get the permissions value from the files attributes - NSNumber *permissionsValue = (NSNumber *)attributes[NSFilePosixPermissions]; - if (permissionsValue) { - short permissionsShort = permissionsValue.shortValue; - NSInteger permissionsOctal = 0100000 + permissionsShort; - uLong permissionsLong = @(permissionsOctal).unsignedLongValue; - zipInformation.external_fa = permissionsLong << 16L; - } - } - - zipOpenNewFileInZip(_zip, aFileName, &zipInformation, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION); - void *buffer = malloc(CHUNK); - unsigned int len = 0; - - while (!feof(input)) { - len = (unsigned int) fread(buffer, 1, CHUNK, input); - zipWriteInFileInZip(_zip, buffer, len); - } - - zipCloseFileInZip(_zip); - free(buffer); - - return YES; -} - -- (BOOL)writeData:(NSData *)data fileName:(NSString *)fileName { - if (!_zip) { - return NO; - } - - if (!data) { - return NO; - } - - zip_fileinfo zipInformation = {{0,0,0,0,0,0},0,0,0}; - [self zipInformation:&zipInformation setDate:[NSDate date]]; - zipOpenNewFileInZip(_zip, [fileName UTF8String], &zipInformation, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION); - zipWriteInFileInZip(_zip, data.bytes, (unsigned int)data.length); - zipCloseFileInZip(_zip); - - return YES; -} - -- (BOOL)close { - NSAssert((NULL != _zip), @"[ZipArchive] Attempting to close an archive that has never been opened."); - zipClose(_zip, NULL); - - return YES; -} - -#pragma mark - Private - -// Format from http://newsgroups.derkeiler.com/Archive/Comp/comp.os.msdos.programmer/2009-04/msg00060.html -// Two consecutive words or a longword. "YYYYYYYMMMMDDDDD" or "hhhhhmmmmmmsssss" -// YYYYYYY is years from 1980 = 0 -// sssss is (seconds / 2). -// -// 3658 = 0011 0110 0101 1000 = 0011011 0010 11000 = 27 2 24 = 2007-02-24 -// 7423 = 0111 0100 0010 0011 - 01110 100001 00011 = 14 33 2 = 14:33:06 -+ (NSDate *)dateWithMicrosoftDOSFormat:(UInt32)microsoftDOSDateTime { - static const UInt32 kYearMask = 0xFE000000; - static const UInt32 kMonthMask = 0x1E00000; - static const UInt32 kDayMask = 0x1F0000; - static const UInt32 kHourMask = 0xF800; - static const UInt32 kMinuteMask = 0x7E0; - static const UInt32 kSecondMask = 0x1F; - - static NSCalendar *gregorian; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ -#if defined(__IPHONE_8_0) || defined(__MAC_10_10) - gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; -#else - gregorian = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar]; -#endif - }); - - NSDateComponents *components = [[NSDateComponents alloc] init]; - NSAssert(0xFFFFFFFF == (kYearMask | kMonthMask | kDayMask | kHourMask | kMinuteMask | kSecondMask), @"[ZipArchive] MSDos date masks don't add up."); - - [components setYear:1980 + ((microsoftDOSDateTime & kYearMask) >> 25)]; - [components setMonth:(microsoftDOSDateTime & kMonthMask) >> 21]; - [components setDay:(microsoftDOSDateTime & kDayMask) >> 16]; - [components setHour:(microsoftDOSDateTime & kHourMask) >> 11]; - [components setMinute:(microsoftDOSDateTime & kMinuteMask) >> 5]; - [components setSecond:(microsoftDOSDateTime & kSecondMask) * 2]; - - NSDate *date = [NSDate dateWithTimeInterval:0 sinceDate:[gregorian dateFromComponents:components]]; - - return date; -} - -@end diff --git a/ZipArchive/ZipArchive.h b/ZipArchive/ZipArchive.h deleted file mode 100644 index a35a626..0000000 --- a/ZipArchive/ZipArchive.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ZipArchive.h -// ZipArchive -// -// Created by Douglas Bumby on 2015-07-11. -// Copyright (c) 2015 Cosmic Labs. All rights reserved. -// - -#import - -//! Project version number for ZipArchive. -FOUNDATION_EXPORT double ZipArchiveVersionNumber; - -//! Project version string for ZipArchive. -FOUNDATION_EXPORT const unsigned char ZipArchiveVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - -#import \ No newline at end of file diff --git a/ZipArchiveTests/CollectingDelegate.h b/ZipArchiveTests/CollectingDelegate.h deleted file mode 100644 index a8ad08a..0000000 --- a/ZipArchiveTests/CollectingDelegate.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// CollectingDelegate.h -// ZipArchive -// -// Originally Created by Chris on 2012-01-12. -// Copyright (c) 2015 ZipArchive. All rights reserved. -// - -#import -#import "Main.h" - -/** - * Test delegate by collecting its calls - */ - -@interface CollectingDelegate : NSObject - -@property(nonatomic, retain) NSMutableArray *files; - -@end \ No newline at end of file diff --git a/ZipArchiveTests/Fixtures/SymbolicLink.zip b/ZipArchiveTests/Fixtures/SymbolicLink.zip deleted file mode 100644 index d2296a1..0000000 Binary files a/ZipArchiveTests/Fixtures/SymbolicLink.zip and /dev/null differ diff --git a/ZipArchiveTests/ZipArchiveTests.m b/ZipArchiveTests/ZipArchiveTests.m deleted file mode 100644 index f21f2a7..0000000 --- a/ZipArchiveTests/ZipArchiveTests.m +++ /dev/null @@ -1,419 +0,0 @@ -// -// ZipArchiveTests.m -// ZipArchiveTests -// -// Created by Sam Soffes on 2010-03-11. -// Copyright (c) 2015 ZipArchive. All rights reserved. -// - -#import "ZipArchive/Main.h" -#import "CollectingDelegate.h" -#import -#import - -@interface CancelDelegate : NSObject - -@property (nonatomic, assign) int numberOfFilesUnzipped; -@property (nonatomic, assign) int numberOfFilesToUnzip; -@property (nonatomic, assign) BOOL didUnzipArchive; -@property (nonatomic, assign) int loaded; -@property (nonatomic, assign) int total; - -@end - -@implementation CancelDelegate - -- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInformation:(unz_file_info)fileInformation { - _numberOfFilesUnzipped = (int)fileIndex + 1; -} - -- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInformation:(unz_file_info)fileInformation { - return _numberOfFilesUnzipped < _numberOfFilesToUnzip; -} - -- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInformation:(unz_global_info)zipInformation unzippedPath:(NSString *)unzippedPath { - _didUnzipArchive = YES; -} - -- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total { - _loaded = (int)loaded; - _total = (int)total; -} - -@end - -@interface ZipArchiveTests : XCTestCase -@end - -@implementation ZipArchiveTests { - NSMutableArray *progressEvents; -} - -- (void)setUp { - [super setUp]; - - progressEvents = [NSMutableArray array]; -} - -- (void)tearDown { - [super tearDown]; - - [[NSFileManager defaultManager] removeItemAtPath:[self _cachesPath:nil] error:nil]; -} - -- (void)testZipping { - // Use extracted files from [-testUnzipping] - NSString *inputPath = [self _cachesPath:@"Regular"]; - NSArray *inputPaths = @[[inputPath stringByAppendingPathComponent:@"Readme.markdown"], - [inputPath stringByAppendingPathComponent:@"LICENSE"]]; - NSString *outputPath = [self _cachesPath:@"Zipped"]; - NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedArchive.zip"]; - - [Main createZipFileAtPath:archivePath - withFilesAtPaths:inputPaths]; - - // TODO: - Make sure the files are actually unzipped. They are, but the test could be better. - XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Archive Created."); -} - -- (void)testDirectoryZipping { - NSString *inputPath = [self _cachesPath:@"Unicode"]; - NSString *outputPath = [self _cachesPath:@"FolderZipped"]; - NSString *archivePath = [outputPath stringByAppendingPathComponent:@"ArchiveWithFolders.zip"]; - - [Main createZipFileAtPath:archivePath - withContentsOfDirectory:inputPath]; - - XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Folder Archive created"); -} - -- (void)testMultipleZipping { - NSArray *inputPaths = @[[[NSBundle mainBundle] pathForResource:@"0" ofType:@"m4a"], - [[NSBundle mainBundle] pathForResource:@"1" ofType:@"m4a"], - [[NSBundle mainBundle] pathForResource:@"2" ofType:@"m4a"], - [[NSBundle mainBundle] pathForResource:@"3" ofType:@"m4a"], - [[NSBundle mainBundle] pathForResource:@"4" ofType:@"m4a"], - [[NSBundle mainBundle] pathForResource:@"5" ofType:@"m4a"], - [[NSBundle mainBundle] pathForResource:@"6" ofType:@"m4a"], - [[NSBundle mainBundle] pathForResource:@"7" ofType:@"m4a"]]; - NSString *outputPath = [self _cachesPath:@"Zipped"]; - - for (int test = 0; test < 1000; test++) { - NSString *archivePath = [outputPath stringByAppendingPathComponent:[NSString stringWithFormat:@"queue_test_%d.zip", test]]; - - [Main createZipFileAtPath:archivePath - withFilesAtPaths:inputPaths]; - - long long threshold = 510000; - long long fileSize = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:nil][NSFileSize] longLongValue]; - - XCTAssertTrue(fileSize > threshold, @"Zipping failed at %lld", fileSize); - } -} - -- (void)testUnzipping { - NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"]; - NSString *outputPath = [self _cachesPath:@"Regular"]; - - [Main unzipFileAtPath:zipPath - toDestination:outputPath - delegate:self]; - - NSFileManager *fileManager = [NSFileManager defaultManager]; - NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"]; - XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"README Unzipped."); - - testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"]; - XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE Unzipped."); -} - -- (void)testSmallFileUnzipping { - NSString *zipPath = [[NSBundle mainBundle] pathForResource:@"hello" ofType:@"zip"]; - NSString *outputPath = [self _cachesPath:@"Regular"]; - - [Main unzipFileAtPath:zipPath - toDestination:outputPath - delegate:self]; - - NSFileManager *fileManager = [NSFileManager defaultManager]; - NSString *testPath = [outputPath stringByAppendingPathComponent:@"REadme.markdown"]; - XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"README Unzipped"); - - testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"]; - XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE Unzipped"); -} - -- (void)testUnzippingProgress { - NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"]; - NSString *outputPath = [self _cachesPath:@"Progress"]; - - [progressEvents removeAllObjects]; - [Main unzipFileAtPath:zipPath - toDestination:outputPath - delegate:self]; - - // 4 Events: The first, then for each of the two files one, then the final event - XCTAssertTrue(4 == [progressEvents count], @"Expected 4 progress events"); - XCTAssertTrue(0 == [progressEvents[0] intValue]); - XCTAssertTrue(619 == [progressEvents[1] intValue]); - XCTAssertTrue(1114 == [progressEvents[2] intValue]); - XCTAssertTrue(1436 == [progressEvents[3] intValue]); -} - -- (void)testUnzippingWithTest { - NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestPasswordArchive" ofType:@"zip"]; - NSString *outputPath = [self _cachesPath:@"Password"]; - NSError *error = nil; - - [Main unzipFileAtPath:zipPath - toDestination:outputPath - overwrite:YES - password:@"passw0rd" - error:error - delegate:self]; - - NSFileManager *fileManager = [NSFileManager defaultManager]; - NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"]; - XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme Unzipped"); - - testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"]; - XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE Unzipped"); -} - -- (void)testUnzippingTruncatedFileFix { - NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"IncorrectHeaders" ofType:@"zip"]; - NSString *outputPath = [self _cachesPath:@"IncorrectHeaders"]; - - [Main unzipFileAtPath:zipPath - toDestination:outputPath - delegate:self]; - - NSString *intendedReadmeTxtMD5 = @"31ac96301302eb388070c827447290b5"; - - NSString *filePath = [outputPath stringByAppendingPathComponent:@"IncorrectHeaders/Readme.txt"]; - NSData *data = [NSData dataWithContentsOfFile:filePath]; - - NSString *actualReadmeTxtMD5 = [self _calculateMD5Digest:data]; - XCTAssertTrue([actualReadmeTxtMD5 isEqualToString:intendedReadmeTxtMD5], @"Readme.txt MD5 digest should match original."); -} - -- (void)testUnzippingWithSymlinkedFileInside { - NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"SymbolicLink" ofType:@"zip"]; - NSString *outputPath = [self _cachesPath:@"SymbolicLink"]; - - [Main unzipFileAtPath:zipPath - toDestination:outputPath - delegate:self]; - - NSString *testSymlinkFolder = [outputPath stringByAppendingPathComponent:@"SymbolicLink/Github.app"]; - NSString *testSymlinkFile = [outputPath stringByAppendingPathComponent:@"SymbolicLink/Icon.icns"]; - NSError *error = nil; - NSString *symlinkFolderPath = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath:testSymlinkFolder error:&error]; - BOOL symbolicLinkToFolderPersists = ((nil != symlinkFolderPath) && [symlinkFolderPath isEqualToString:@"/Applications/Github.app"]) && (nil == error); - - error = nil; - - NSString *symlinkFilePath = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath:testSymlinkFile error:&error]; - BOOL symbolicLinkToFilePersists = ((nil != symlinkFilePath) && [symlinkFilePath isEqualToString:@"/Applications/Github.app/Contents/Resources/AppIcon.icns"]) && (nil == error); - - XCTAssertTrue(symbolicLinkToFilePersists && symbolicLinkToFolderPersists, @"Symbolic links should persist from the original archive to the outputted files."); -} - -- (void)testUnzippingWithRelativeSymlink { - NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"RelativeSymbolicLink" ofType:@"zip"]; - NSString *outputPath = [self _cachesPath:@"RelativeSymbolicLink"]; - - [Main unzipFileAtPath:zipPath - toDestination:outputPath - delegate:self]; - - // Determine where the symlinks are - NSString *subfolderName = @"symlinks"; - NSString *testBasePath = [NSString pathWithComponents:@[outputPath]]; - NSString *testSymlinkFolder = [NSString pathWithComponents:@[testBasePath, subfolderName, @"folderSymlink"]]; - NSString *testSymlinkFile = [NSString pathWithComponents:@[testBasePath, subfolderName, @"fileSymlink"]]; - - // Determine where the files they link to are - NSString *parentDirectory = @"../"; - NSString *testSymlinkFolderTarget = [NSString pathWithComponents:@[parentDirectory, @"symlinkedFolder"]]; - NSString *testSymlinkFileTarget = [NSString pathWithComponents:@[parentDirectory, @"symlinkedFile"]]; - - NSError *error = nil; - - NSString *symlinkFolderPath = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath:testSymlinkFolder error:&error]; - BOOL symbolicLinkToFolderPersists = ((nil != symlinkFolderPath) && [symlinkFolderPath isEqualToString:testSymlinkFolderTarget]) && (nil == error); - - error = nil; - - NSString *symlinkFilePath = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath:testSymlinkFile error:&error]; - BOOL symbolicLinkToFilePersists = ((nil != symlinkFilePath) && [symlinkFilePath isEqualToString:testSymlinkFileTarget]) && (nil == error); - - XCTAssertTrue(symbolicLinkToFilePersists && symbolicLinkToFolderPersists, @"Relative symbolic links should persist from the original archive to the outputted files (and also remain relative)."); -} - -- (void)testZippingAndUnzippingForDate { - NSString *inputPath = [self _cachesPath:@"Regular"]; - NSArray *inputPaths = @[[inputPath stringByAppendingPathComponent:@"Readme.markdown"]]; - - NSDictionary *originalFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[inputPath stringByAppendingPathComponent:@"Readme.markdown"] error:nil]; - - NSString *outputPath = [self _cachesPath:@"ZippedDate"]; - NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedArchive.zip"]; - - [Main - createZipFileAtPath:archivePath - withFilesAtPaths:inputPaths]; - - [Main unzipFileAtPath:archivePath - toDestination:outputPath - delegate:self]; - - NSDictionary *createdFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[outputPath stringByAppendingPathComponent:@"Readme.markdown"] error:nil]; - - XCTAssertEqualObjects(originalFileAttributes[NSFileCreationDate], createdFileAttributes[@"NSFileCreationDate"], @"Orginal file creationDate should match created one"); -} - -- (void)testZippingAndUnzippingForPermissions { - // File we're going to test permissions on before and after zipping - NSString *targetFile = @"/Contents/MacOS/TestProject"; - - // ZIPPING - NSString *inputFile = [[NSBundle mainBundle] pathForResource:@"PermissionsTestApp" ofType:@"app"]; - NSString *targetFilePreZipPath = [inputFile stringByAppendingPathComponent:targetFile]; - NSDictionary *preZipAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:targetFilePreZipPath error:nil]; - - NSString *outputDirectory = [self _cachesPath:@"PermissionsTest"]; - NSString *archivePath = [outputDirectory stringByAppendingPathComponent:@"TestAppArchive.zip"]; - - [Main createZipFileAtPath:archivePath - withContentsOfDirectory:inputFile]; - - // UNZIPPING - [Main unzipFileAtPath:archivePath - toDestination:outputDirectory]; - - NSString *targetFilePath = [outputDirectory stringByAppendingPathComponent:@"/Contents/MacOS/TestProject"]; - NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:targetFilePath error:nil]; - - XCTAssertEqual(fileAttributes[NSFilePosixPermissions], preZipAttributes[NSFilePosixPermissions], @"File permissions should be retained during compression and de-compression"); -} - -- (void)testUnzippingWithCancel { - NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"]; - NSString *outputPath = [self _cachesPath:@"Cancel1"]; - - CancelDelegate *delegate = [[CancelDelegate alloc] init]; - delegate.numberOfFilesToUnzip = 1; - - [Main unzipFileAtPath:zipPath - toDestination:outputPath - delegate:delegate]; - - XCTAssertEqual(delegate.numberOfFilesUnzipped, 1); - XCTAssertFalse(delegate.didUnzipArchive); - XCTAssertNotEqual(delegate.loaded, delegate.total); - - outputPath = [self _cachesPath:@"Cancel2"]; - - delegate = [[CancelDelegate alloc] init]; - delegate.numberOfFilesToUnzip = 1000; - - [Main unzipFileAtPath:zipPath - toDestination:outputPath - delegate:delegate]; - - XCTAssertEqual(delegate.numberOfFilesUnzipped, 2); - XCTAssertTrue(delegate.didUnzipArchive); - XCTAssertEqual(delegate.loaded, delegate.total); -} - -// Commented out to avoid checking in several gig file into the repository. Simply add a file named -// `LargeArchive.zip` to the project and uncomment out these lines to test. -- (void)testUnzippingLargeFiles { - NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"LargeArchive" ofType:@"zip"]; - NSString *outputPath = [self _cachesPath:@"Large"]; - - [Main unzipFileAtPath:zipPath - toDestination:outputPath]; -} - -- (void)testShouldProvidePathOfUnzippedFileInDelegateCallback { - CollectingDelegate *collector = [CollectingDelegate new]; - NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"]; - NSString *outputPath = [self _cachesPath:@"Regular"]; - - [Main unzipFileAtPath:zipPath - toDestination:outputPath - delegate:collector]; -} - -#pragma mark - ZipArchiveDelegate -- (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path - zipInformation:(unz_global_info)zipInformation { - NSLog(@"zipArchiveWillUnzipArchiveAtPath: %@ zipInformation:", path); -} - -- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path - zipInformation:(unz_global_info)zipInformation - unzippedPath:(NSString *)unzippedPath { - NSLog(@"zipArchiveDidUnzipArchiveAtPath: %@ zipInformation: unzippedPath: %@", path, unzippedPath); -} - -- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex - totalFiles:(NSInteger)totalFiles - archivePath:(NSString *)archivePath - fileInformation:(unz_file_info)fileInformation { - NSLog(@"zipArchiveShouldUnzipFileAtIndex: %d totalFiles: %d archivePath: %@ fileInformation:", (int)fileIndex, (int)totalFiles, archivePath); - - return YES; -} - -- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex - totalFiles:(NSInteger)totalFiles - archivePath:(NSString *)archivePath - fileInformation:(unz_file_info)fileInformation { - NSLog(@"zipArchiveWillUnzipFileAtIndex: %d totalFiles: %d archivePath: %@ fileInformation:", (int)fileIndex, (int)totalFiles, archivePath); -} - -- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex - totalFiles:(NSInteger)totalFiles - archivePath:(NSString *)archivePath - fileInformation:(unz_file_info)fileInformation { - NSLog(@"zipArchiveDidUnzipFileAtIndex: %d totalFiles: %d archivePath: %@ fileInformation:", (int)fileIndex, (int)totalFiles, archivePath); -} - -- (void)zipArchiveProgressEvent:(unsigned long long)loaded - total:(unsigned long long)total { - NSLog(@"zipArchiveProgressEvent: loaded: %d total: %d", (int)loaded, (int)total); - [progressEvents addObject:@(loaded)]; -} - -#pragma mark - Private -- (NSString *)_cachesPath:(NSString *)directory { - NSString *path = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] - stringByAppendingPathComponent:@"com.SamSoffes.ZipArchive.tests"]; - if (directory) { - path = [path stringByAppendingPathComponent:directory]; - } - - NSFileManager *fileManager = [NSFileManager defaultManager]; - if (![fileManager fileExistsAtPath:path]) { - [fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil]; - } - - return path; -} - -- (NSString *)_calculateMD5Digest:(NSData *)data { - unsigned char digest[CC_MD5_DIGEST_LENGTH], i; - CC_MD5(data.bytes, (unsigned int)data.length, digest); - NSMutableString *string = [NSMutableString string]; - - for (i = 0; i < CC_MD5_DIGEST_LENGTH; i++) { - [string appendFormat:@"%02x", (int)(digest[i])]; - } - - return [string copy]; -} - -@end \ No newline at end of file