Commit 167daeaa authored by Jake's avatar Jake

Merge remote-tracking branch 'marmelroy/master'

parents c898c506 2a3e908d
...@@ -72,5 +72,5 @@ github "marmelroy/Zip" ...@@ -72,5 +72,5 @@ github "marmelroy/Zip"
### Setting up with [CocoaPods](http://cocoapods.org/?q=Zip) ### Setting up with [CocoaPods](http://cocoapods.org/?q=Zip)
```ruby ```ruby
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
pod 'Zip', '~> 0.3' pod 'Zip', '~> 0.4'
``` ```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.4.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>6</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "Zip" s.name = "Zip"
s.version = "0.3.4" s.version = "0.4.1"
s.summary = "Zip and unzip files in Swift." s.summary = "Zip and unzip files in Swift."
# This description is used to generate tags and improve search results. # This description is used to generate tags and improve search results.
......
...@@ -7,6 +7,39 @@ ...@@ -7,6 +7,39 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
3425458E1CE525B200336074 /* prng.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0E11C5044DC0023A3C3 /* prng.c */; };
3425458F1CE525B200336074 /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0DF1C5044DC0023A3C3 /* hmac.c */; };
342545901CE525B200336074 /* Zip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347E3AD71C1E04C900A11FD3 /* Zip.swift */; };
342545911CE525B200336074 /* aestab.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0D71C5044DC0023A3C3 /* aestab.c */; };
342545921CE525B200336074 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0EB1C5044DC0023A3C3 /* unzip.c */; };
342545931CE525B200336074 /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0D41C5044DC0023A3C3 /* aescrypt.c */; };
342545941CE525B200336074 /* QuickZip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3443A3F51C4AB8A3004AD173 /* QuickZip.swift */; };
342545951CE525B200336074 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0E81C5044DC0023A3C3 /* ioapi.c */; };
342545961CE525B200336074 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0E51C5044DC0023A3C3 /* sha1.c */; };
342545971CE525B200336074 /* pwd2key.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0E31C5044DC0023A3C3 /* pwd2key.c */; };
342545981CE525B200336074 /* aeskey.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0D51C5044DC0023A3C3 /* aeskey.c */; };
342545991CE525B200336074 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0ED1C5044DC0023A3C3 /* zip.c */; };
3425459A1CE525B200336074 /* ZipUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 343625BA1C5827DC0023C4C6 /* ZipUtilities.swift */; };
3425459B1CE525B200336074 /* fileenc.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0DD1C5044DC0023A3C3 /* fileenc.c */; };
3425459C1CE525B200336074 /* entropy.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0DB1C5044DC0023A3C3 /* entropy.c */; };
3425459E1CE525B200336074 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3430F61F1C45C805007473A6 /* libz.tbd */; };
342545A01CE525B200336074 /* sha1.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0E61C5044DC0023A3C3 /* sha1.h */; };
342545A11CE525B200336074 /* zip.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0EE1C5044DC0023A3C3 /* zip.h */; };
342545A21CE525B200336074 /* entropy.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0DC1C5044DC0023A3C3 /* entropy.h */; };
342545A31CE525B200336074 /* pwd2key.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0E41C5044DC0023A3C3 /* pwd2key.h */; };
342545A41CE525B200336074 /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0EC1C5044DC0023A3C3 /* unzip.h */; };
342545A51CE525B200336074 /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0D21C5044DC0023A3C3 /* aes.h */; };
342545A61CE525B200336074 /* aestab.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0D81C5044DC0023A3C3 /* aestab.h */; };
342545A71CE525B200336074 /* crypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0E71C5044DC0023A3C3 /* crypt.h */; };
342545A81CE525B200336074 /* fileenc.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0DE1C5044DC0023A3C3 /* fileenc.h */; };
342545A91CE525B200336074 /* aes_via_ace.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0D31C5044DC0023A3C3 /* aes_via_ace.h */; };
342545AA1CE525B200336074 /* prng.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0E21C5044DC0023A3C3 /* prng.h */; };
342545AB1CE525B200336074 /* ioapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0E91C5044DC0023A3C3 /* ioapi.h */; };
342545AC1CE525B200336074 /* hmac.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0E01C5044DC0023A3C3 /* hmac.h */; };
342545AD1CE525B200336074 /* aesopt.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0D61C5044DC0023A3C3 /* aesopt.h */; };
342545AE1CE525B200336074 /* Zip.h in Headers */ = {isa = PBXBuildFile; fileRef = 347E3A771C1DFFB500A11FD3 /* Zip.h */; settings = {ATTRIBUTES = (Public, ); }; };
342545AF1CE525B200336074 /* brg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0DA1C5044DC0023A3C3 /* brg_types.h */; };
342545B01CE525B200336074 /* brg_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0D91C5044DC0023A3C3 /* brg_endian.h */; };
342FC0EF1C5044DC0023A3C3 /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0D21C5044DC0023A3C3 /* aes.h */; }; 342FC0EF1C5044DC0023A3C3 /* aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0D21C5044DC0023A3C3 /* aes.h */; };
342FC0F01C5044DC0023A3C3 /* aes_via_ace.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0D31C5044DC0023A3C3 /* aes_via_ace.h */; }; 342FC0F01C5044DC0023A3C3 /* aes_via_ace.h in Headers */ = {isa = PBXBuildFile; fileRef = 342FC0D31C5044DC0023A3C3 /* aes_via_ace.h */; };
342FC0F11C5044DC0023A3C3 /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0D41C5044DC0023A3C3 /* aescrypt.c */; }; 342FC0F11C5044DC0023A3C3 /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 342FC0D41C5044DC0023A3C3 /* aescrypt.c */; };
...@@ -99,6 +132,8 @@ ...@@ -99,6 +132,8 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
342545B51CE525B200336074 /* Zip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Zip.framework; sourceTree = BUILT_PRODUCTS_DIR; };
342545B61CE525B300336074 /* Zip copy-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Zip copy-Info.plist"; path = "/Users/marmelroy/Documents/Projects/OpenSource/Zip/Zip copy-Info.plist"; sourceTree = "<absolute>"; };
342FC0D21C5044DC0023A3C3 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; }; 342FC0D21C5044DC0023A3C3 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; };
342FC0D31C5044DC0023A3C3 /* aes_via_ace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes_via_ace.h; sourceTree = "<group>"; }; 342FC0D31C5044DC0023A3C3 /* aes_via_ace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes_via_ace.h; sourceTree = "<group>"; };
342FC0D41C5044DC0023A3C3 /* aescrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aescrypt.c; sourceTree = "<group>"; }; 342FC0D41C5044DC0023A3C3 /* aescrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aescrypt.c; sourceTree = "<group>"; };
...@@ -132,6 +167,7 @@ ...@@ -132,6 +167,7 @@
343625BA1C5827DC0023C4C6 /* ZipUtilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZipUtilities.swift; sourceTree = "<group>"; }; 343625BA1C5827DC0023C4C6 /* ZipUtilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZipUtilities.swift; sourceTree = "<group>"; };
343F50FF1C8DAEEC0028C434 /* Zip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Zip.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 343F50FF1C8DAEEC0028C434 /* Zip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Zip.framework; sourceTree = BUILT_PRODUCTS_DIR; };
343F51081C8DAEEC0028C434 /* Zip OSXTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Zip OSXTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 343F51081C8DAEEC0028C434 /* Zip OSXTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Zip OSXTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
344050D91CE28F59001AFF0F /* Info-tvOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Info-tvOS.plist"; path = "/Users/marmelroy/Documents/Projects/OpenSource/Zip/Zip/Info-tvOS.plist"; sourceTree = "<absolute>"; };
3443A3F51C4AB8A3004AD173 /* QuickZip.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuickZip.swift; sourceTree = "<group>"; }; 3443A3F51C4AB8A3004AD173 /* QuickZip.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuickZip.swift; sourceTree = "<group>"; };
3443A3FC1C4AD199004AD173 /* bb8.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = bb8.zip; sourceTree = "<group>"; }; 3443A3FC1C4AD199004AD173 /* bb8.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = bb8.zip; sourceTree = "<group>"; };
347E3A741C1DFFB500A11FD3 /* Zip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Zip.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 347E3A741C1DFFB500A11FD3 /* Zip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Zip.framework; sourceTree = BUILT_PRODUCTS_DIR; };
...@@ -146,6 +182,14 @@ ...@@ -146,6 +182,14 @@
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
3425459D1CE525B200336074 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3425459E1CE525B200336074 /* libz.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
343F50FB1C8DAEEC0028C434 /* Frameworks */ = { 343F50FB1C8DAEEC0028C434 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -231,6 +275,7 @@ ...@@ -231,6 +275,7 @@
347E3A761C1DFFB500A11FD3 /* Zip */, 347E3A761C1DFFB500A11FD3 /* Zip */,
347E3A821C1DFFB500A11FD3 /* ZipTests */, 347E3A821C1DFFB500A11FD3 /* ZipTests */,
347E3A751C1DFFB500A11FD3 /* Products */, 347E3A751C1DFFB500A11FD3 /* Products */,
342545B61CE525B300336074 /* Zip copy-Info.plist */,
); );
sourceTree = "<group>"; sourceTree = "<group>";
}; };
...@@ -241,6 +286,7 @@ ...@@ -241,6 +286,7 @@
347E3A7E1C1DFFB500A11FD3 /* ZipTests.xctest */, 347E3A7E1C1DFFB500A11FD3 /* ZipTests.xctest */,
343F50FF1C8DAEEC0028C434 /* Zip.framework */, 343F50FF1C8DAEEC0028C434 /* Zip.framework */,
343F51081C8DAEEC0028C434 /* Zip OSXTests.xctest */, 343F51081C8DAEEC0028C434 /* Zip OSXTests.xctest */,
342545B51CE525B200336074 /* Zip.framework */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -251,6 +297,7 @@ ...@@ -251,6 +297,7 @@
342FC0D01C5044DC0023A3C3 /* minizip */, 342FC0D01C5044DC0023A3C3 /* minizip */,
347E3A771C1DFFB500A11FD3 /* Zip.h */, 347E3A771C1DFFB500A11FD3 /* Zip.h */,
347E3A791C1DFFB500A11FD3 /* Info.plist */, 347E3A791C1DFFB500A11FD3 /* Info.plist */,
344050D91CE28F59001AFF0F /* Info-tvOS.plist */,
347E3AD71C1E04C900A11FD3 /* Zip.swift */, 347E3AD71C1E04C900A11FD3 /* Zip.swift */,
343625BA1C5827DC0023C4C6 /* ZipUtilities.swift */, 343625BA1C5827DC0023C4C6 /* ZipUtilities.swift */,
3443A3F51C4AB8A3004AD173 /* QuickZip.swift */, 3443A3F51C4AB8A3004AD173 /* QuickZip.swift */,
...@@ -274,6 +321,30 @@ ...@@ -274,6 +321,30 @@
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */ /* Begin PBXHeadersBuildPhase section */
3425459F1CE525B200336074 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
342545A01CE525B200336074 /* sha1.h in Headers */,
342545A11CE525B200336074 /* zip.h in Headers */,
342545A21CE525B200336074 /* entropy.h in Headers */,
342545A31CE525B200336074 /* pwd2key.h in Headers */,
342545A41CE525B200336074 /* unzip.h in Headers */,
342545A51CE525B200336074 /* aes.h in Headers */,
342545A61CE525B200336074 /* aestab.h in Headers */,
342545A71CE525B200336074 /* crypt.h in Headers */,
342545A81CE525B200336074 /* fileenc.h in Headers */,
342545A91CE525B200336074 /* aes_via_ace.h in Headers */,
342545AA1CE525B200336074 /* prng.h in Headers */,
342545AB1CE525B200336074 /* ioapi.h in Headers */,
342545AC1CE525B200336074 /* hmac.h in Headers */,
342545AD1CE525B200336074 /* aesopt.h in Headers */,
342545AE1CE525B200336074 /* Zip.h in Headers */,
342545AF1CE525B200336074 /* brg_types.h in Headers */,
342545B01CE525B200336074 /* brg_endian.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
343F50FC1C8DAEEC0028C434 /* Headers */ = { 343F50FC1C8DAEEC0028C434 /* Headers */ = {
isa = PBXHeadersBuildPhase; isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -325,6 +396,24 @@ ...@@ -325,6 +396,24 @@
/* End PBXHeadersBuildPhase section */ /* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
3425458C1CE525B200336074 /* Zip tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 342545B21CE525B200336074 /* Build configuration list for PBXNativeTarget "Zip tvOS" */;
buildPhases = (
3425458D1CE525B200336074 /* Sources */,
3425459D1CE525B200336074 /* Frameworks */,
3425459F1CE525B200336074 /* Headers */,
342545B11CE525B200336074 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Zip tvOS";
productName = Zip;
productReference = 342545B51CE525B200336074 /* Zip.framework */;
productType = "com.apple.product-type.framework";
};
343F50FE1C8DAEEC0028C434 /* Zip OSX */ = { 343F50FE1C8DAEEC0028C434 /* Zip OSX */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 343F51141C8DAEEC0028C434 /* Build configuration list for PBXNativeTarget "Zip OSX" */; buildConfigurationList = 343F51141C8DAEEC0028C434 /* Build configuration list for PBXNativeTarget "Zip OSX" */;
...@@ -437,11 +526,19 @@ ...@@ -437,11 +526,19 @@
347E3A7D1C1DFFB500A11FD3 /* ZipTests */, 347E3A7D1C1DFFB500A11FD3 /* ZipTests */,
343F50FE1C8DAEEC0028C434 /* Zip OSX */, 343F50FE1C8DAEEC0028C434 /* Zip OSX */,
343F51071C8DAEEC0028C434 /* Zip OSXTests */, 343F51071C8DAEEC0028C434 /* Zip OSXTests */,
3425458C1CE525B200336074 /* Zip tvOS */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */ /* Begin PBXResourcesBuildPhase section */
342545B11CE525B200336074 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
343F50FD1C8DAEEC0028C434 /* Resources */ = { 343F50FD1C8DAEEC0028C434 /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -476,6 +573,28 @@ ...@@ -476,6 +573,28 @@
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
3425458D1CE525B200336074 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3425458E1CE525B200336074 /* prng.c in Sources */,
3425458F1CE525B200336074 /* hmac.c in Sources */,
342545901CE525B200336074 /* Zip.swift in Sources */,
342545911CE525B200336074 /* aestab.c in Sources */,
342545921CE525B200336074 /* unzip.c in Sources */,
342545931CE525B200336074 /* aescrypt.c in Sources */,
342545941CE525B200336074 /* QuickZip.swift in Sources */,
342545951CE525B200336074 /* ioapi.c in Sources */,
342545961CE525B200336074 /* sha1.c in Sources */,
342545971CE525B200336074 /* pwd2key.c in Sources */,
342545981CE525B200336074 /* aeskey.c in Sources */,
342545991CE525B200336074 /* zip.c in Sources */,
3425459A1CE525B200336074 /* ZipUtilities.swift in Sources */,
3425459B1CE525B200336074 /* fileenc.c in Sources */,
3425459C1CE525B200336074 /* entropy.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
343F50FA1C8DAEEC0028C434 /* Sources */ = { 343F50FA1C8DAEEC0028C434 /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -551,15 +670,64 @@ ...@@ -551,15 +670,64 @@
/* End PBXTargetDependency section */ /* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
342545B31CE525B200336074 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 6;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "Zip copy-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Zip;
PRODUCT_NAME = Zip;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
SWIFT_INCLUDE_PATHS = "${SRCROOT}/Zip/minizip/**";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
};
342545B41CE525B200336074 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 6;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "Zip copy-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Zip;
PRODUCT_NAME = Zip;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvsimulator appletvos";
SWIFT_INCLUDE_PATHS = "${SRCROOT}/Zip/minizip/**";
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Release;
};
343F51101C8DAEEC0028C434 /* Debug */ = { 343F51101C8DAEEC0028C434 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 6;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 4; DYLIB_CURRENT_VERSION = 6;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A; FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Zip/Info.plist; INFOPLIST_FILE = Zip/Info.plist;
...@@ -579,10 +747,10 @@ ...@@ -579,10 +747,10 @@
buildSettings = { buildSettings = {
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 6;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 4; DYLIB_CURRENT_VERSION = 6;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A; FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Zip/Info.plist; INFOPLIST_FILE = Zip/Info.plist;
...@@ -644,7 +812,7 @@ ...@@ -644,7 +812,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 6;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
...@@ -692,7 +860,7 @@ ...@@ -692,7 +860,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 4; CURRENT_PROJECT_VERSION = 6;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
...@@ -721,7 +889,7 @@ ...@@ -721,7 +889,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 4; DYLIB_CURRENT_VERSION = 6;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Zip/Info.plist; INFOPLIST_FILE = Zip/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
...@@ -743,7 +911,7 @@ ...@@ -743,7 +911,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 4; DYLIB_CURRENT_VERSION = 6;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Zip/Info.plist; INFOPLIST_FILE = Zip/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
...@@ -780,6 +948,15 @@ ...@@ -780,6 +948,15 @@
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
342545B21CE525B200336074 /* Build configuration list for PBXNativeTarget "Zip tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
342545B31CE525B200336074 /* Debug */,
342545B41CE525B200336074 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
343F51141C8DAEEC0028C434 /* Build configuration list for PBXNativeTarget "Zip OSX" */ = { 343F51141C8DAEEC0028C434 /* Build configuration list for PBXNativeTarget "Zip OSX" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3425458C1CE525B200336074"
BuildableName = "Zip.framework"
BlueprintName = "Zip tvOS"
ReferencedContainer = "container:Zip.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3425458C1CE525B200336074"
BuildableName = "Zip.framework"
BlueprintName = "Zip tvOS"
ReferencedContainer = "container:Zip.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3425458C1CE525B200336074"
BuildableName = "Zip.framework"
BlueprintName = "Zip tvOS"
ReferencedContainer = "container:Zip.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.4.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>6</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.3.4</string> <string>0.4.1</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>4</string> <string>6</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string></string> <string></string>
</dict> </dict>
......
...@@ -11,7 +11,7 @@ import Foundation ...@@ -11,7 +11,7 @@ import Foundation
extension Zip { extension Zip {
//MARK: Quick Unzip //MARK: Quick Unzip
/** /**
Quick unzip a file. Unzips to a new folder inside the app's documents folder with the zip file's name. Quick unzip a file. Unzips to a new folder inside the app's documents folder with the zip file's name.
...@@ -33,6 +33,8 @@ extension Zip { ...@@ -33,6 +33,8 @@ extension Zip {
- throws: Error if unzipping fails or if file is not found. Can be printed with a description variable. - throws: Error if unzipping fails or if file is not found. Can be printed with a description variable.
- notes: Supports implicit progress composition
- returns: NSURL of the destination folder. - returns: NSURL of the destination folder.
*/ */
public class func quickUnzipFile(path: NSURL, progress: ((progress: Double) -> ())?) throws -> NSURL { public class func quickUnzipFile(path: NSURL, progress: ((progress: Double) -> ())?) throws -> NSURL {
...@@ -50,30 +52,34 @@ extension Zip { ...@@ -50,30 +52,34 @@ extension Zip {
//MARK: Quick Zip //MARK: Quick Zip
/** /**
Quick zip files. Quick zip files.
- parameter paths: Array of NSURL filepaths. - parameter paths: Array of NSURL filepaths.
- parameter fileName: File name for the resulting zip file. - parameter fileName: File name for the resulting zip file.
- throws: Error if zipping fails. - throws: Error if zipping fails.
- returns: NSURL of the destination folder. - notes: Supports implicit progress composition
*/
- returns: NSURL of the destination folder.
*/
public class func quickZipFiles(paths: [NSURL], fileName: String) throws -> NSURL { public class func quickZipFiles(paths: [NSURL], fileName: String) throws -> NSURL {
return try quickZipFiles(paths, fileName: fileName, progress: nil) return try quickZipFiles(paths, fileName: fileName, progress: nil)
} }
/**
Quick zip files.
- parameter paths: Array of NSURL filepaths.
- parameter fileName: File name for the resulting zip file.
- parameter progress: A progress closure called after unzipping each file in the archive. Double value betweem 0 and 1.
- throws: Error if zipping fails.
- returns: NSURL of the destination folder. /**
*/ Quick zip files.
- parameter paths: Array of NSURL filepaths.
- parameter fileName: File name for the resulting zip file.
- parameter progress: A progress closure called after unzipping each file in the archive. Double value betweem 0 and 1.
- throws: Error if zipping fails.
- notes: Supports implicit progress composition
- returns: NSURL of the destination folder.
*/
public class func quickZipFiles(paths: [NSURL], fileName: String, progress: ((progress: Double) -> ())?) throws -> NSURL { public class func quickZipFiles(paths: [NSURL], fileName: String, progress: ((progress: Double) -> ())?) throws -> NSURL {
let fileManager = NSFileManager.defaultManager() let fileManager = NSFileManager.defaultManager()
let documentsUrl = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL let documentsUrl = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
...@@ -82,5 +88,5 @@ extension Zip { ...@@ -82,5 +88,5 @@ extension Zip {
return destinationUrl return destinationUrl
} }
} }
\ No newline at end of file
...@@ -17,7 +17,7 @@ public enum ZipError: ErrorType { ...@@ -17,7 +17,7 @@ public enum ZipError: ErrorType {
case UnzipFail case UnzipFail
/// Zip fail /// Zip fail
case ZipFail case ZipFail
/// User readable description /// User readable description
public var description: String { public var description: String {
switch self { switch self {
...@@ -31,6 +31,11 @@ public enum ZipError: ErrorType { ...@@ -31,6 +31,11 @@ public enum ZipError: ErrorType {
/// Zip class /// Zip class
public class Zip { public class Zip {
/**
Set of vaild file extensions
*/
internal static var customFileExtensions: Set<String> = []
// MARK: Lifecycle // MARK: Lifecycle
/** /**
...@@ -42,7 +47,7 @@ public class Zip { ...@@ -42,7 +47,7 @@ public class Zip {
} }
// MARK: Unzip // MARK: Unzip
/** /**
Unzip file Unzip file
...@@ -51,20 +56,22 @@ public class Zip { ...@@ -51,20 +56,22 @@ public class Zip {
- parameter overwrite: Overwrite bool. - parameter overwrite: Overwrite bool.
- parameter password: Optional password if file is protected. - parameter password: Optional password if file is protected.
- parameter progress: A progress closure called after unzipping each file in the archive. Double value betweem 0 and 1. - parameter progress: A progress closure called after unzipping each file in the archive. Double value betweem 0 and 1.
- throws: Error if unzipping fails or if fail is not found. Can be printed with a description variable. - throws: Error if unzipping fails or if fail is not found. Can be printed with a description variable.
- notes: Supports implicit progress composition
*/ */
public class func unzipFile(zipFilePath: NSURL, destination: NSURL, overwrite: Bool, password: String?, progress: ((progress: Double) -> ())?) throws { public class func unzipFile(zipFilePath: NSURL, destination: NSURL, overwrite: Bool, password: String?, progress: ((progress: Double) -> ())?) throws {
// File manager // File manager
let fileManager = NSFileManager.defaultManager() let fileManager = NSFileManager.defaultManager()
// Check whether a zip file exists at path. // Check whether a zip file exists at path.
guard let path = zipFilePath.path where destination.path != nil else { guard let path = zipFilePath.path where destination.path != nil else {
throw ZipError.FileNotFound throw ZipError.FileNotFound
} }
if fileManager.fileExistsAtPath(path) == false || zipFilePath.pathExtension != "zip" { if fileManager.fileExistsAtPath(path) == false || fileExtensionIsInvalid(zipFilePath.pathExtension) {
throw ZipError.FileNotFound throw ZipError.FileNotFound
} }
...@@ -81,9 +88,17 @@ public class Zip { ...@@ -81,9 +88,17 @@ public class Zip {
if let attributeFileSize = fileAttributes[NSFileSize] as? Double { if let attributeFileSize = fileAttributes[NSFileSize] as? Double {
totalSize += attributeFileSize totalSize += attributeFileSize
} }
let progressTracker = NSProgress(totalUnitCount: Int64(totalSize))
progressTracker.cancellable = false
progressTracker.pausable = false
progressTracker.kind = NSProgressKindFile
// Begin unzipping // Begin unzipping
let zip = unzOpen64(path) let zip = unzOpen64(path)
defer {
unzClose(zip)
}
if unzGoToFirstFile(zip) != UNZ_OK { if unzGoToFirstFile(zip) != UNZ_OK {
throw ZipError.UnzipFail throw ZipError.UnzipFail
} }
...@@ -165,27 +180,33 @@ public class Zip { ...@@ -165,27 +180,33 @@ public class Zip {
progressHandler(progress: (currentPosition/totalSize)) progressHandler(progress: (currentPosition/totalSize))
} }
progressTracker.completedUnitCount = Int64(currentPosition)
} while (ret == UNZ_OK && ret != UNZ_END_OF_LIST_OF_FILE) } while (ret == UNZ_OK && ret != UNZ_END_OF_LIST_OF_FILE)
// Completed. Update progress handler. // Completed. Update progress handler.
if let progressHandler = progress{ if let progressHandler = progress{
progressHandler(progress: 1.0) progressHandler(progress: 1.0)
} }
progressTracker.completedUnitCount = Int64(totalSize)
} }
// MARK: Zip // MARK: Zip
/** /**
Zip files. Zip files.
- parameter paths: Array of NSURL filepaths. - parameter paths: Array of NSURL filepaths.
- parameter zipFilePath: Destination NSURL, should lead to a .zip filepath. - parameter zipFilePath: Destination NSURL, should lead to a .zip filepath.
- parameter password: Password string. Optional. - parameter password: Password string. Optional.
- parameter progress: A progress closure called after unzipping each file in the archive. Double value betweem 0 and 1. - parameter progress: A progress closure called after unzipping each file in the archive. Double value betweem 0 and 1.
- throws: Error if zipping fails. - throws: Error if zipping fails.
*/
- notes: Supports implicit progress composition
*/
public class func zipFiles(paths: [NSURL], zipFilePath: NSURL, password: String?, progress: ((progress: Double) -> ())?) throws { public class func zipFiles(paths: [NSURL], zipFilePath: NSURL, password: String?, progress: ((progress: Double) -> ())?) throws {
// File manager // File manager
...@@ -218,6 +239,11 @@ public class Zip { ...@@ -218,6 +239,11 @@ public class Zip {
catch {} catch {}
} }
let progressTracker = NSProgress(totalUnitCount: Int64(totalSize))
progressTracker.cancellable = false
progressTracker.pausable = false
progressTracker.kind = NSProgressKindFile
// Begin Zipping // Begin Zipping
let zip = zipOpen(destinationPath, APPEND_STATUS_CREATE) let zip = zipOpen(destinationPath, APPEND_STATUS_CREATE)
for path in processedPaths { for path in processedPaths {
...@@ -268,6 +294,8 @@ public class Zip { ...@@ -268,6 +294,8 @@ public class Zip {
progressHandler(progress: (currentPosition/totalSize)) progressHandler(progress: (currentPosition/totalSize))
} }
progressTracker.completedUnitCount = Int64(currentPosition)
zipCloseFileInZip(zip) zipCloseFileInZip(zip)
free(buffer) free(buffer)
fclose(input) fclose(input)
...@@ -279,8 +307,54 @@ public class Zip { ...@@ -279,8 +307,54 @@ public class Zip {
if let progressHandler = progress{ if let progressHandler = progress{
progressHandler(progress: 1.0) progressHandler(progress: 1.0)
} }
progressTracker.completedUnitCount = Int64(totalSize)
} }
/**
Check if file extension is invalid.
- parameter fileExtension: A file extension.
- returns: false if the extension is a valid file extension, otherwise true.
*/
internal class func fileExtensionIsInvalid(fileExtension: String?) -> Bool {
guard let fileExtension = fileExtension else { return true }
return !isValidFileExtension(fileExtension)
}
/**
} Add a file extension to the set of custom file extensions
\ No newline at end of file
- parameter fileExtension: A file extension.
*/
public class func addCustomFileExtension(fileExtension: String) {
customFileExtensions.insert(fileExtension)
}
/**
Remove a file extension from the set of custom file extensions
- parameter fileExtension: A file extension.
*/
public class func removeCustomFileExtension(fileExtension: String) {
customFileExtensions.remove(fileExtension)
}
/**
Check if a specific file extension is valid
- parameter fileExtension: A file extension.
- returns: true if the extension valid, otherwise false.
*/
public class func isValidFileExtension(fileExtension: String) -> Bool {
let validFileExtensions: Set<String> = customFileExtensions.union(["zip", "cbz"])
return validFileExtensions.contains(fileExtension)
}
}
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>BNDL</string> <string>BNDL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.3.4</string> <string>0.4.1</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>4</string> <string>6</string>
</dict> </dict>
</plist> </plist>
...@@ -43,7 +43,7 @@ class ZipTests: XCTestCase { ...@@ -43,7 +43,7 @@ class ZipTests: XCTestCase {
XCTAssert(true) XCTAssert(true)
} }
} }
func testQuickUnzipNonZipPath() { func testQuickUnzipNonZipPath() {
do { do {
let filePath = NSBundle(forClass: ZipTests.self).URLForResource("3crBXeO", withExtension: "gif")! let filePath = NSBundle(forClass: ZipTests.self).URLForResource("3crBXeO", withExtension: "gif")!
...@@ -84,9 +84,11 @@ class ZipTests: XCTestCase { ...@@ -84,9 +84,11 @@ class ZipTests: XCTestCase {
do { do {
let filePath = NSBundle(forClass: ZipTests.self).URLForResource("bb8", withExtension: "zip")! let filePath = NSBundle(forClass: ZipTests.self).URLForResource("bb8", withExtension: "zip")!
let documentsFolder = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL let documentsFolder = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
try Zip.unzipFile(filePath, destination: documentsFolder, overwrite: true, password: "password", progress: { (progress) -> () in try Zip.unzipFile(filePath, destination: documentsFolder, overwrite: true, password: "password", progress: { (progress) -> () in
print(progress) print(progress)
}) })
let fileManager = NSFileManager.defaultManager() let fileManager = NSFileManager.defaultManager()
XCTAssertTrue(fileManager.fileExistsAtPath(documentsFolder.path!)) XCTAssertTrue(fileManager.fileExistsAtPath(documentsFolder.path!))
} }
...@@ -95,6 +97,48 @@ class ZipTests: XCTestCase { ...@@ -95,6 +97,48 @@ class ZipTests: XCTestCase {
} }
} }
func testImplicitProgressUnzip() {
do {
let progress = NSProgress()
progress.totalUnitCount = 1
let filePath = NSBundle(forClass: ZipTests.self).URLForResource("bb8", withExtension: "zip")!
let documentsFolder = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
progress.becomeCurrentWithPendingUnitCount(1)
try Zip.unzipFile(filePath, destination: documentsFolder, overwrite: true, password: "password", progress: nil)
progress.resignCurrent()
XCTAssertTrue(progress.totalUnitCount == progress.completedUnitCount)
}
catch {
XCTFail()
}
}
func testImplicitProgressZip() {
do {
let progress = NSProgress()
progress.totalUnitCount = 1
let imageURL1 = NSBundle(forClass: ZipTests.self).URLForResource("3crBXeO", withExtension: "gif")!
let imageURL2 = NSBundle(forClass: ZipTests.self).URLForResource("kYkLkPf", withExtension: "gif")!
let documentsFolder = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
let zipFilePath = documentsFolder.URLByAppendingPathComponent("archive.zip")
progress.becomeCurrentWithPendingUnitCount(1)
try Zip.zipFiles([imageURL1, imageURL2], zipFilePath: zipFilePath, password: nil, progress: nil)
progress.resignCurrent()
XCTAssertTrue(progress.totalUnitCount == progress.completedUnitCount)
}
catch {
XCTFail()
}
}
func testQuickZip() { func testQuickZip() {
do { do {
let imageURL1 = NSBundle(forClass: ZipTests.self).URLForResource("3crBXeO", withExtension: "gif")! let imageURL1 = NSBundle(forClass: ZipTests.self).URLForResource("3crBXeO", withExtension: "gif")!
...@@ -129,7 +173,7 @@ class ZipTests: XCTestCase { ...@@ -129,7 +173,7 @@ class ZipTests: XCTestCase {
XCTFail() XCTFail()
} }
} }
func testZip() { func testZip() {
do { do {
...@@ -148,6 +192,32 @@ class ZipTests: XCTestCase { ...@@ -148,6 +192,32 @@ class ZipTests: XCTestCase {
} }
} }
func testZipUnzipPassword() {
do {
let imageURL1 = NSBundle(forClass: ZipTests.self).URLForResource("3crBXeO", withExtension: "gif")!
let imageURL2 = NSBundle(forClass: ZipTests.self).URLForResource("kYkLkPf", withExtension: "gif")!
let documentsFolder = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
let zipFilePath = documentsFolder.URLByAppendingPathComponent("archive.zip")
try Zip.zipFiles([imageURL1, imageURL2], zipFilePath: zipFilePath, password: "password", progress: { (progress) -> () in
print(progress)
})
let fileManager = NSFileManager.defaultManager()
XCTAssertTrue(fileManager.fileExistsAtPath(zipFilePath.path!))
guard let fileExtension = zipFilePath.pathExtension, let fileName = zipFilePath.lastPathComponent else {
throw ZipError.UnzipFail
}
let directoryName = fileName.stringByReplacingOccurrencesOfString(".\(fileExtension)", withString: "")
let documentsUrl = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
let destinationUrl = documentsUrl.URLByAppendingPathComponent(directoryName, isDirectory: true)
try Zip.unzipFile(zipFilePath, destination: destinationUrl, overwrite: true, password: "password", progress: nil)
XCTAssertTrue(fileManager.fileExistsAtPath(destinationUrl.path!))
}
catch {
XCTFail()
}
}
func testQuickUnzipSubDir() { func testQuickUnzipSubDir() {
do { do {
let bookURL = NSBundle(forClass: ZipTests.self).URLForResource("bb8", withExtension: "zip")! let bookURL = NSBundle(forClass: ZipTests.self).URLForResource("bb8", withExtension: "zip")!
...@@ -165,5 +235,44 @@ class ZipTests: XCTestCase { ...@@ -165,5 +235,44 @@ class ZipTests: XCTestCase {
} }
} }
func testFileExtensionIsNotInvalidForValidUrl() {
let fileUrl = NSURL(string: "file.cbz")
let result = Zip.fileExtensionIsInvalid(fileUrl?.pathExtension)
XCTAssertFalse(result)
}
func testFileExtensionIsInvalidForInvalidUrl() {
let fileUrl = NSURL(string: "file.xyz")
let result = Zip.fileExtensionIsInvalid(fileUrl?.pathExtension)
XCTAssertTrue(result)
}
func testAddedCustomFileExtensionIsValid() {
let fileExtension = "cstm"
Zip.addCustomFileExtension(fileExtension)
let result = Zip.isValidFileExtension(fileExtension)
XCTAssertTrue(result)
Zip.removeCustomFileExtension(fileExtension)
}
func testRemovedCustomFileExtensionIsInvalid() {
let fileExtension = "cstm"
Zip.addCustomFileExtension(fileExtension)
Zip.removeCustomFileExtension(fileExtension)
let result = Zip.isValidFileExtension(fileExtension)
XCTAssertFalse(result)
}
func testDefaultFileExtensionsIsValid() {
XCTAssertTrue(Zip.isValidFileExtension("zip"))
XCTAssertTrue(Zip.isValidFileExtension("cbz"))
}
func testDefaultFileExtensionsIsNotRemoved() {
Zip.removeCustomFileExtension("zip")
Zip.removeCustomFileExtension("cbz")
XCTAssertTrue(Zip.isValidFileExtension("zip"))
XCTAssertTrue(Zip.isValidFileExtension("cbz"))
}
} }
...@@ -40,7 +40,7 @@ if [ "$MODE" = "examples" ]; then ...@@ -40,7 +40,7 @@ if [ "$MODE" = "examples" ]; then
-scheme Sample \ -scheme Sample \
-sdk "$SDK" \ -sdk "$SDK" \
-destination "$PLATFORM" \ -destination "$PLATFORM" \
build test build
done done
trap - EXIT trap - EXIT
exit 0 exit 0
......
...@@ -2,4 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git' ...@@ -2,4 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, "9.0" platform :ios, "9.0"
use_frameworks! use_frameworks!
target Sample do
pod 'Zip', :git => 'https://github.com/marmelroy/Zip.git', :submodules => true pod 'Zip', :git => 'https://github.com/marmelroy/Zip.git', :submodules => true
end
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment