Compare commits
35 Commits
v2.0.8
...
IncorrectH
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ae03a2145 | ||
|
|
fab301b90f | ||
|
|
e5962afc05 | ||
|
|
236f31d25a | ||
|
|
01d1d9e770 | ||
|
|
1fd7fa9c29 | ||
|
|
2886108b12 | ||
|
|
45d2faf540 | ||
|
|
308b7c9849 | ||
|
|
96d988d3f8 | ||
|
|
6746665b71 | ||
|
|
a9bb0f948c | ||
|
|
e38ad24bd8 | ||
|
|
a9eb253d90 | ||
|
|
181bdc693e | ||
|
|
df25a4a43e | ||
|
|
252fb76ff4 | ||
|
|
b8a68d1a08 | ||
|
|
ed887bd062 | ||
|
|
7ce0c7cc66 | ||
|
|
7143ecdc66 | ||
|
|
708a2c76d8 | ||
|
|
2ab252766d | ||
|
|
27cf1ec538 | ||
|
|
5a7f52bf50 | ||
|
|
f59a2d6670 | ||
|
|
0634a08c75 | ||
|
|
1011c5ec05 | ||
|
|
1b253ad445 | ||
|
|
b7097ae6bb | ||
|
|
6bf9406cff | ||
|
|
2e8fd082ca | ||
|
|
917cdd6d73 | ||
|
|
b660cccd24 | ||
|
|
2821ab5d3e |
87
.travis.yml
87
.travis.yml
@@ -1,42 +1,87 @@
|
||||
language: objective-c
|
||||
podfile: ObjectiveCExample/Podfile
|
||||
xcode_workspace: ObjectiveCExample/ObjectiveCExample.xcworkspace
|
||||
xcode_scheme: ObjectiveCExample
|
||||
matrix:
|
||||
include:
|
||||
- osx_image: xcode9 # OS X 10.12
|
||||
env: SDK="macosx"
|
||||
DEVICE="OS X 10.12"
|
||||
|
||||
- osx_image: xcode8.3 # OS X 10.12
|
||||
env: SDK="macosx"
|
||||
DEVICE="OS X 10.12"
|
||||
|
||||
- osx_image: xcode7.3 # OS X 10.11
|
||||
env: SDK="macosx"
|
||||
DEVICE="OS X 10.11"
|
||||
|
||||
- osx_image: xcode9
|
||||
env: DESTINATION="iPhone X (11.0)" # oldest/newest for iOS 11.x
|
||||
|
||||
env: SDK="appletvsimulator"
|
||||
DEVICE="Apple TV 4K (11.0)" # oldest/newest for tvOS 11.x
|
||||
|
||||
- osx_image: xcode8.3
|
||||
env: SDK="appletvsimulator"
|
||||
DEVICE="Apple TV 1080p (10.2)" # latest for tvOS 10.x
|
||||
|
||||
- osx_image: xcode8.3
|
||||
env: SDK="appletvsimulator"
|
||||
DEVICE="Apple TV 1080p (9.2)" # latest for tvOS 9.x
|
||||
|
||||
- osx_image: xcode7.3
|
||||
env: SDK="appletvsimulator"
|
||||
DEVICE="Apple TV 1080p (9.0)" # oldest for tvOS 9.x
|
||||
|
||||
- osx_image: xcode9
|
||||
env: DESTINATION="iPhone 7 Plus (10.3.1)" # latest for iOS 10.x
|
||||
|
||||
env: SDK="iphonesimulator"
|
||||
DEVICE="iPhone X (11.0)" # oldest/newest for iOS 11.x
|
||||
|
||||
- osx_image: xcode9
|
||||
env: SDK="iphonesimulator"
|
||||
DEVICE="iPhone 7 Plus (10.3.1)" # latest for iOS 10.x
|
||||
|
||||
- osx_image: xcode8.3
|
||||
env: DESTINATION="iPhone 5 (10.0)" # oldest for iOS 10.x
|
||||
|
||||
env: SDK="iphonesimulator"
|
||||
DEVICE="iPhone 5 (10.0)" # oldest for iOS 10.x
|
||||
|
||||
- osx_image: xcode8.3
|
||||
env: DESTINATION="iPhone 6s Plus (9.3)" # latest for iOS 9.x
|
||||
|
||||
env: SDK="iphonesimulator"
|
||||
DEVICE="iPhone 6s Plus (9.3)" # latest for iOS 9.x
|
||||
|
||||
- osx_image: xcode7.3
|
||||
env: DESTINATION="iPhone 4s (9.0)" # oldest for iOS 9.x
|
||||
|
||||
env: SDK="iphonesimulator"
|
||||
DEVICE="iPhone 4s (9.0)" # oldest for iOS 9.x
|
||||
|
||||
- osx_image: xcode7.3
|
||||
env: DESTINATION="iPhone 6 Plus (8.4)" # latest for iOS 8.x
|
||||
|
||||
env: SDK="iphonesimulator"
|
||||
DEVICE="iPhone 6 Plus (8.4)" # latest for iOS 8.x
|
||||
|
||||
- osx_image: xcode7.3
|
||||
env: DESTINATION="iPhone 4s (8.1)" # oldest for iOS 8.x
|
||||
env: SDK="iphonesimulator"
|
||||
DEVICE="iPhone 4s (8.1)" # oldest for iOS 8.x
|
||||
|
||||
before_install:
|
||||
# Grepping destination device udid
|
||||
- DESTINATION_UDID=$(instruments -s devices | grep "$DESTINATION \[" | sed -E 's/.*\[([0-9A-F-]+)\].*/\1/g')
|
||||
# Prelaunching simulator to avoid timeout https://github.com/travis-ci/travis-ci/issues/6422
|
||||
- open -a "simulator" --args -CurrentDeviceUDID $DESTINATION_UDID
|
||||
- if [ ${SDK} = "macosx" ]; then
|
||||
SCHEME="ObjectiveCExample_macOS";
|
||||
elif [ ${SDK} = "appletvsimulator" ]; then
|
||||
SCHEME="ObjectiveCExample_tvOS";
|
||||
else
|
||||
SCHEME="ObjectiveCExample_iOS";
|
||||
fi
|
||||
- if [ ${SDK} = "macosx" ]; then
|
||||
DESTINATION="platform=macosx";
|
||||
else
|
||||
DESTINATION_UDID=$(instruments -s devices | grep "$DEVICE \[" | sed -E 's/.*\[([0-9A-F-]+)\].*/\1/g');
|
||||
`Prelaunching simulator to avoid timeout https://github.com/travis-ci/travis-ci/issues/6422`
|
||||
open -a Simulator --args -CurrentDeviceUDID $DESTINATION_UDID;
|
||||
DESTINATION="id=$DESTINATION_UDID";
|
||||
fi
|
||||
|
||||
script:
|
||||
# Testing
|
||||
- xcodebuild
|
||||
`` -workspace ObjectiveCExample/ObjectiveCExample.xcworkspace
|
||||
`` -scheme ObjectiveCExample_iOS
|
||||
`` -sdk iphonesimulator
|
||||
`` -destination "id=$DESTINATION_UDID"
|
||||
`` -scheme $SCHEME
|
||||
`` -sdk $SDK
|
||||
`` -destination "$DESTINATION"
|
||||
`` -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES
|
||||
`` test
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
3754B1331F88961C00A58AA0 /* Empty.zip in Resources */ = {isa = PBXBuildFile; fileRef = 3754B1311F88961800A58AA0 /* Empty.zip */; };
|
||||
3754B1341F88961D00A58AA0 /* Empty.zip in Resources */ = {isa = PBXBuildFile; fileRef = 3754B1311F88961800A58AA0 /* Empty.zip */; };
|
||||
3754B1351F88961E00A58AA0 /* Empty.zip in Resources */ = {isa = PBXBuildFile; fileRef = 3754B1311F88961800A58AA0 /* Empty.zip */; };
|
||||
3773ADB61F7F453E009A4B2D /* CollectingDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */; };
|
||||
3773ADB71F7F4541009A4B2D /* SSZipArchiveTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */; };
|
||||
3773ADB81F7F4D13009A4B2D /* hello.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A161BDAA10100709011 /* hello.zip */; };
|
||||
@@ -43,6 +46,12 @@
|
||||
3793E6EE1F7F6059000B1A19 /* TestPasswordArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1C1BDAA10100709011 /* TestPasswordArchive.zip */; };
|
||||
3793E6EF1F7F6059000B1A19 /* Unicode.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1D1BDAA10100709011 /* Unicode.zip */; };
|
||||
3793E6F01F7F605C000B1A19 /* PermissionsTestApp.app in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A181BDAA10100709011 /* PermissionsTestApp.app */; };
|
||||
37FF0CB31F8533E0006E4361 /* CancelDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB21F8533E0006E4361 /* CancelDelegate.m */; };
|
||||
37FF0CB41F8533E0006E4361 /* CancelDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB21F8533E0006E4361 /* CancelDelegate.m */; };
|
||||
37FF0CB51F8533E0006E4361 /* CancelDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB21F8533E0006E4361 /* CancelDelegate.m */; };
|
||||
37FF0CB81F853459006E4361 /* ProgressDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB71F853459006E4361 /* ProgressDelegate.m */; };
|
||||
37FF0CB91F853459006E4361 /* ProgressDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB71F853459006E4361 /* ProgressDelegate.m */; };
|
||||
37FF0CBA1F853459006E4361 /* ProgressDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 37FF0CB71F853459006E4361 /* ProgressDelegate.m */; };
|
||||
6BFA1E5841DFEC4E21BA7543 /* Pods_core_ObjectiveCExampleTests_macOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 38A85B006A1C84E475375AE1 /* Pods_core_ObjectiveCExampleTests_macOS.framework */; };
|
||||
8DFE19EF1BDA9FF300709011 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19EE1BDA9FF300709011 /* main.m */; };
|
||||
8DFE19F21BDA9FF300709011 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19F11BDA9FF300709011 /* AppDelegate.m */; };
|
||||
@@ -74,21 +83,16 @@
|
||||
F7D6D86D1CFB2C4900DA6DA6 /* Sample Data in Resources */ = {isa = PBXBuildFile; fileRef = F7D6D86C1CFB2C4900DA6DA6 /* Sample Data */; };
|
||||
/* 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 */
|
||||
04CB37570807602F7E5C66D9 /* Pods-core-ObjectiveCExampleTests_macOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExampleTests_macOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_macOS/Pods-core-ObjectiveCExampleTests_macOS.release.xcconfig"; sourceTree = "<group>"; };
|
||||
254DE0B206EE66F57BBE7EEE /* Pods-core-ObjectiveCExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExample/Pods-core-ObjectiveCExample.release.xcconfig"; sourceTree = "<group>"; };
|
||||
3754B1311F88961800A58AA0 /* Empty.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Empty.zip; sourceTree = "<group>"; };
|
||||
3773ADAE1F7F44D8009A4B2D /* ObjectiveCExampleTests_macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObjectiveCExampleTests_macOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3793E6D71F7F5F93000B1A19 /* ObjectiveCExampleTests_tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObjectiveCExampleTests_tvOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
37FF0CB11F8533E0006E4361 /* CancelDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CancelDelegate.h; sourceTree = "<group>"; };
|
||||
37FF0CB21F8533E0006E4361 /* CancelDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CancelDelegate.m; sourceTree = "<group>"; };
|
||||
37FF0CB61F853459006E4361 /* ProgressDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ProgressDelegate.h; sourceTree = "<group>"; };
|
||||
37FF0CB71F853459006E4361 /* ProgressDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ProgressDelegate.m; sourceTree = "<group>"; };
|
||||
38A85B006A1C84E475375AE1 /* Pods_core_ObjectiveCExampleTests_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_core_ObjectiveCExampleTests_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
48AB7DF053F85FCC6AFB0C26 /* Pods-core-ObjectiveCExampleTests_macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-core-ObjectiveCExampleTests_macOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-core-ObjectiveCExampleTests_macOS/Pods-core-ObjectiveCExampleTests_macOS.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
49974600DB985CD98FC3AD39 /* Pods_core_ObjectiveCExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_core_ObjectiveCExample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -104,7 +108,7 @@
|
||||
8DFE19FC1BDA9FF300709011 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
8DFE19FE1BDA9FF300709011 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests_iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObjectiveCExampleTests_iOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSZipArchiveTests.m; sourceTree = "<group>"; };
|
||||
8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSZipArchiveTests.m; sourceTree = "<group>"; };
|
||||
8DFE1A091BDA9FF300709011 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8DFE1A121BDAA0A800709011 /* CollectingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectingDelegate.h; sourceTree = "<group>"; };
|
||||
8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CollectingDelegate.m; sourceTree = "<group>"; };
|
||||
@@ -238,6 +242,10 @@
|
||||
8DFE1A1E1BDAA10100709011 /* Multi_Zip_Test */,
|
||||
8DFE1A121BDAA0A800709011 /* CollectingDelegate.h */,
|
||||
8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */,
|
||||
37FF0CB11F8533E0006E4361 /* CancelDelegate.h */,
|
||||
37FF0CB21F8533E0006E4361 /* CancelDelegate.m */,
|
||||
37FF0CB61F853459006E4361 /* ProgressDelegate.h */,
|
||||
37FF0CB71F853459006E4361 /* ProgressDelegate.m */,
|
||||
8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */,
|
||||
8DFE1A091BDA9FF300709011 /* Info.plist */,
|
||||
);
|
||||
@@ -247,6 +255,7 @@
|
||||
8DFE1A151BDAA10100709011 /* Fixtures */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3754B1311F88961800A58AA0 /* Empty.zip */,
|
||||
8DFE1A161BDAA10100709011 /* hello.zip */,
|
||||
8DFE1A171BDAA10100709011 /* IncorrectHeaders.zip */,
|
||||
8DFE1A181BDAA10100709011 /* PermissionsTestApp.app */,
|
||||
@@ -362,7 +371,6 @@
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
8DFE1A051BDA9FF300709011 /* PBXTargetDependency */,
|
||||
);
|
||||
name = ObjectiveCExampleTests_iOS;
|
||||
productName = ObjectiveCExampleTests;
|
||||
@@ -390,7 +398,6 @@
|
||||
};
|
||||
8DFE1A021BDA9FF300709011 = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
TestTargetID = 8DFE19E91BDA9FF300709011;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -423,6 +430,7 @@
|
||||
3773ADC31F7F4D1C009A4B2D /* 3.m4a in Resources */,
|
||||
3773ADC21F7F4D1C009A4B2D /* 2.m4a in Resources */,
|
||||
3773ADC41F7F4D1C009A4B2D /* 4.m4a in Resources */,
|
||||
3754B1341F88961D00A58AA0 /* Empty.zip in Resources */,
|
||||
3773ADC01F7F4D1C009A4B2D /* 0.m4a in Resources */,
|
||||
3773ADC51F7F4D1C009A4B2D /* 5.m4a in Resources */,
|
||||
3773ADB91F7F4D13009A4B2D /* IncorrectHeaders.zip in Resources */,
|
||||
@@ -446,6 +454,7 @@
|
||||
3793E6E71F7F6052000B1A19 /* 6.m4a in Resources */,
|
||||
3793E6E91F7F6059000B1A19 /* hello.zip in Resources */,
|
||||
3793E6F01F7F605C000B1A19 /* PermissionsTestApp.app in Resources */,
|
||||
3754B1351F88961E00A58AA0 /* Empty.zip in Resources */,
|
||||
3793E6ED1F7F6059000B1A19 /* TestArchive.zip in Resources */,
|
||||
3793E6E61F7F6052000B1A19 /* 5.m4a in Resources */,
|
||||
3793E6E41F7F6052000B1A19 /* 3.m4a in Resources */,
|
||||
@@ -480,6 +489,7 @@
|
||||
8DFE1A321BDAA10100709011 /* 3.m4a in Resources */,
|
||||
8DFE1A311BDAA10100709011 /* 2.m4a in Resources */,
|
||||
8DFE1A331BDAA10100709011 /* 4.m4a in Resources */,
|
||||
3754B1331F88961C00A58AA0 /* Empty.zip in Resources */,
|
||||
8DFE1A2F1BDAA10100709011 /* 0.m4a in Resources */,
|
||||
8DFE1A341BDAA10100709011 /* 5.m4a in Resources */,
|
||||
8DFE1A2D1BDAA10100709011 /* TestPasswordArchive.zip in Resources */,
|
||||
@@ -711,7 +721,9 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3773ADB71F7F4541009A4B2D /* SSZipArchiveTests.m in Sources */,
|
||||
37FF0CB91F853459006E4361 /* ProgressDelegate.m in Sources */,
|
||||
3773ADB61F7F453E009A4B2D /* CollectingDelegate.m in Sources */,
|
||||
37FF0CB41F8533E0006E4361 /* CancelDelegate.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -720,7 +732,9 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3793E6E01F7F604B000B1A19 /* SSZipArchiveTests.m in Sources */,
|
||||
37FF0CBA1F853459006E4361 /* ProgressDelegate.m in Sources */,
|
||||
3793E6DF1F7F6048000B1A19 /* CollectingDelegate.m in Sources */,
|
||||
37FF0CB51F8533E0006E4361 /* CancelDelegate.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -739,20 +753,14 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DFE1A141BDAA0A800709011 /* CollectingDelegate.m in Sources */,
|
||||
37FF0CB81F853459006E4361 /* ProgressDelegate.m in Sources */,
|
||||
8DFE1A081BDA9FF300709011 /* SSZipArchiveTests.m in Sources */,
|
||||
37FF0CB31F8533E0006E4361 /* CancelDelegate.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;
|
||||
@@ -789,7 +797,7 @@
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExample-macOS-test";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExampleTests-macOS";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
@@ -811,7 +819,7 @@
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExample-macOS-test";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExampleTests-macOS";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
@@ -835,7 +843,6 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
TVOS_DEPLOYMENT_TARGET = 11.1;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -857,7 +864,6 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
TVOS_DEPLOYMENT_TARGET = 11.1;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -914,6 +920,7 @@
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -962,6 +969,7 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
@@ -973,7 +981,7 @@
|
||||
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_BUNDLE_IDENTIFIER = com.ziparchive.ObjectiveCExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -985,7 +993,7 @@
|
||||
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_BUNDLE_IDENTIFIER = com.ziparchive.ObjectiveCExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
@@ -994,12 +1002,10 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = A2E5B3BB819D409D02E989BC /* Pods-core-ObjectiveCExampleTests_iOS.debug.xcconfig */;
|
||||
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_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExampleTests-iOS";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObjectiveCExample.app/ObjectiveCExample";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -1007,12 +1013,10 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = CD7C1D2CFA646F90A02312F4 /* Pods-core-ObjectiveCExampleTests_iOS.release.xcconfig */;
|
||||
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_BUNDLE_IDENTIFIER = "com.ziparchive.ObjectiveCExampleTests-iOS";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObjectiveCExample.app/ObjectiveCExample";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForTesting = "NO"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
@@ -20,6 +20,20 @@
|
||||
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8DFE1A021BDA9FF300709011"
|
||||
BuildableName = "ObjectiveCExampleTests_iOS.xctest"
|
||||
BlueprintName = "ObjectiveCExampleTests_iOS"
|
||||
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
|
||||
@@ -5,6 +5,22 @@
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3773ADAD1F7F44D8009A4B2D"
|
||||
BuildableName = "ObjectiveCExampleTests_macOS.xctest"
|
||||
BlueprintName = "ObjectiveCExampleTests_macOS"
|
||||
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
|
||||
@@ -5,6 +5,22 @@
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "NO"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3793E6D61F7F5F93000B1A19"
|
||||
BuildableName = "ObjectiveCExampleTests_tvOS.xctest"
|
||||
BlueprintName = "ObjectiveCExampleTests_tvOS"
|
||||
ReferencedContainer = "container:ObjectiveCExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="retina3_5" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
@@ -14,19 +19,18 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="password" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="KJF-p6-1px">
|
||||
<rect key="frame" x="258.5" y="46" width="83" height="30"/>
|
||||
<rect key="frame" x="118.5" y="46" width="83" height="30"/>
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uTp-oA-6Sj">
|
||||
<rect key="frame" x="244" y="84" width="113" height="30"/>
|
||||
<rect key="frame" x="103.5" y="84" width="113" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="113" id="4gB-hu-j54"/>
|
||||
<constraint firstAttribute="height" constant="30" id="ZCc-Jb-Nvy"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Zip Sample Data"/>
|
||||
@@ -35,10 +39,9 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2Ts-JV-yCW">
|
||||
<rect key="frame" x="235" y="122" width="131" height="30"/>
|
||||
<rect key="frame" x="94.5" y="122" width="131" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="slo-YK-c1X"/>
|
||||
<constraint firstAttribute="width" constant="131" id="tp1-M2-kBk"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Unzip Sample Data"/>
|
||||
<connections>
|
||||
@@ -46,9 +49,8 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="84L-OB-eyZ">
|
||||
<rect key="frame" x="281" y="247" width="39" height="30"/>
|
||||
<rect key="frame" x="140.5" y="247" width="39" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="39" id="ZIK-Ed-EMM"/>
|
||||
<constraint firstAttribute="height" constant="30" id="kpA-B8-VhI"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Reset"/>
|
||||
@@ -56,50 +58,50 @@
|
||||
<action selector="resetPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="8v0-hm-kIr"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="b0V-gX-SgI" userLabel="File3">
|
||||
<rect key="frame" x="60" y="218" width="480" height="21"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File1" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3gB-ZC-0ON" userLabel="File1">
|
||||
<rect key="frame" x="16" y="160" width="288" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="OSM-wR-5Cr"/>
|
||||
<constraint firstAttribute="width" constant="480" id="Sm6-aF-Af6"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3gB-ZC-0ON" userLabel="File1">
|
||||
<rect key="frame" x="60" y="160" width="480" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="480" id="Ng7-H8-Pfv"/>
|
||||
<constraint firstAttribute="height" constant="21" id="yRA-t9-obB"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZxR-a0-kva" userLabel="File2">
|
||||
<rect key="frame" x="60" y="189" width="480" height="21"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File2" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZxR-a0-kva" userLabel="File2">
|
||||
<rect key="frame" x="16" y="189" width="288" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="NgQ-SV-D07"/>
|
||||
<constraint firstAttribute="width" constant="480" id="yJ1-K6-arr"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File3" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="b0V-gX-SgI" userLabel="File3">
|
||||
<rect key="frame" x="16" y="218" width="288" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="OSM-wR-5Cr"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="ZxR-a0-kva" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="0Aj-Zl-ubb"/>
|
||||
<constraint firstItem="uTp-oA-6Sj" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="33K-W3-McX"/>
|
||||
<constraint firstItem="3gB-ZC-0ON" firstAttribute="top" secondItem="2Ts-JV-yCW" secondAttribute="bottom" constant="8" id="3iw-LW-JkX"/>
|
||||
<constraint firstItem="b0V-gX-SgI" firstAttribute="top" secondItem="ZxR-a0-kva" secondAttribute="bottom" constant="8" id="8Av-3o-ggw"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="ZxR-a0-kva" secondAttribute="trailing" id="ABK-aX-afX"/>
|
||||
<constraint firstItem="84L-OB-eyZ" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="B64-sj-Ihu"/>
|
||||
<constraint firstItem="b0V-gX-SgI" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="EEE-ae-qrN"/>
|
||||
<constraint firstItem="3gB-ZC-0ON" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="RQc-UF-4I6"/>
|
||||
<constraint firstItem="KJF-p6-1px" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="26" id="CrE-OB-0QR"/>
|
||||
<constraint firstItem="b0V-gX-SgI" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="N3d-Wl-5jq"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="3gB-ZC-0ON" secondAttribute="trailing" id="Scb-te-5GB"/>
|
||||
<constraint firstItem="ZxR-a0-kva" firstAttribute="top" secondItem="3gB-ZC-0ON" secondAttribute="bottom" constant="8" id="bUv-Zd-r4D"/>
|
||||
<constraint firstItem="uTp-oA-6Sj" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="64" id="hwP-xO-UvR"/>
|
||||
<constraint firstItem="ZxR-a0-kva" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="jRJ-c6-8LV"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="b0V-gX-SgI" secondAttribute="trailing" id="epM-dg-mgw"/>
|
||||
<constraint firstItem="2Ts-JV-yCW" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="lEj-O2-aka"/>
|
||||
<constraint firstItem="2Ts-JV-yCW" firstAttribute="top" secondItem="uTp-oA-6Sj" secondAttribute="bottom" constant="8" id="mnz-Ae-5eG"/>
|
||||
<constraint firstItem="3gB-ZC-0ON" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="twp-26-8CL"/>
|
||||
<constraint firstItem="uTp-oA-6Sj" firstAttribute="top" secondItem="KJF-p6-1px" secondAttribute="bottom" constant="8" symbolic="YES" id="uLh-xJ-Xc6"/>
|
||||
<constraint firstItem="KJF-p6-1px" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="wVb-JQ-3pN"/>
|
||||
<constraint firstItem="84L-OB-eyZ" firstAttribute="top" secondItem="b0V-gX-SgI" secondAttribute="bottom" constant="8" id="xAV-Uy-dqy"/>
|
||||
|
||||
@@ -26,115 +26,123 @@
|
||||
|
||||
#pragma mark - Life Cycle
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[super viewDidLoad];
|
||||
|
||||
_file1.text = @"";
|
||||
_file2.text = @"";
|
||||
_file3.text = @"";
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
}
|
||||
|
||||
#pragma mark - IBAction
|
||||
- (IBAction)zipPressed:(id)sender {
|
||||
NSString *sampleDataPath = [[NSBundle mainBundle].bundleURL
|
||||
URLByAppendingPathComponent:@"Sample Data"
|
||||
isDirectory:YES].path;
|
||||
_zipPath = [self tempZipPath];
|
||||
NSString *password = _passwordField.text;
|
||||
BOOL success = [SSZipArchive createZipFileAtPath:_zipPath
|
||||
withContentsOfDirectory:sampleDataPath
|
||||
withPassword:password.length > 0 ? password : nil];
|
||||
if (success) {
|
||||
_unzipButton.enabled = YES;
|
||||
_zipButton.enabled = NO;
|
||||
} else {
|
||||
NSLog(@"No success");
|
||||
}
|
||||
_resetButton.enabled = YES;
|
||||
NSString *sampleDataPath = [[NSBundle mainBundle].bundleURL
|
||||
URLByAppendingPathComponent:@"Sample Data"
|
||||
isDirectory:YES].path;
|
||||
_zipPath = [self tempZipPath];
|
||||
NSString *password = _passwordField.text;
|
||||
BOOL success = [SSZipArchive createZipFileAtPath:_zipPath
|
||||
withContentsOfDirectory:sampleDataPath
|
||||
keepParentDirectory:NO
|
||||
compressionLevel:-1
|
||||
password:password.length > 0 ? password : nil
|
||||
AES:YES
|
||||
progressHandler:nil];
|
||||
if (success) {
|
||||
NSLog(@"Success zip");
|
||||
_unzipButton.enabled = YES;
|
||||
_zipButton.enabled = NO;
|
||||
} else {
|
||||
NSLog(@"No success zip");
|
||||
}
|
||||
_resetButton.enabled = YES;
|
||||
}
|
||||
|
||||
- (IBAction)unzipPressed:(id)sender {
|
||||
if (!_zipPath) {
|
||||
return;
|
||||
}
|
||||
NSString *unzipPath = [self tempUnzipPath];
|
||||
if (!unzipPath) {
|
||||
return;
|
||||
}
|
||||
NSString *password = _passwordField.text;
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:_zipPath
|
||||
toDestination:unzipPath
|
||||
overwrite:YES
|
||||
password:password.length > 0 ? password : nil
|
||||
error:nil];
|
||||
if (!success) {
|
||||
NSLog(@"No success");
|
||||
return;
|
||||
}
|
||||
NSError *error = nil;
|
||||
NSMutableArray<NSString *> *items = [[[NSFileManager defaultManager]
|
||||
contentsOfDirectoryAtPath:unzipPath
|
||||
error:&error] mutableCopy];
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
[items enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
switch (idx) {
|
||||
case 0: {
|
||||
self.file1.text = obj;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
self.file2.text = obj;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
self.file3.text = obj;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
NSLog(@"Went beyond index of assumed files");
|
||||
break;
|
||||
}
|
||||
if (!_zipPath) {
|
||||
return;
|
||||
}
|
||||
}];
|
||||
_unzipButton.enabled = NO;
|
||||
NSString *unzipPath = [self tempUnzipPath];
|
||||
if (!unzipPath) {
|
||||
return;
|
||||
}
|
||||
NSString *password = _passwordField.text;
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:_zipPath
|
||||
toDestination:unzipPath
|
||||
preserveAttributes:YES
|
||||
overwrite:YES
|
||||
nestedZipLevel:0
|
||||
password:password.length > 0 ? password : nil
|
||||
error:nil
|
||||
delegate:nil
|
||||
progressHandler:nil
|
||||
completionHandler:nil];
|
||||
if (success) {
|
||||
NSLog(@"Success unzip");
|
||||
} else {
|
||||
NSLog(@"No success unzip");
|
||||
return;
|
||||
}
|
||||
NSError *error = nil;
|
||||
NSMutableArray<NSString *> *items = [[[NSFileManager defaultManager]
|
||||
contentsOfDirectoryAtPath:unzipPath
|
||||
error:&error] mutableCopy];
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
[items enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
switch (idx) {
|
||||
case 0: {
|
||||
self.file1.text = obj;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
self.file2.text = obj;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
self.file3.text = obj;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
NSLog(@"Went beyond index of assumed files");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}];
|
||||
_unzipButton.enabled = NO;
|
||||
}
|
||||
|
||||
- (IBAction)resetPressed:(id)sender {
|
||||
_file1.text = @"";
|
||||
_file2.text = @"";
|
||||
_file3.text = @"";
|
||||
_zipButton.enabled = YES;
|
||||
_unzipButton.enabled = NO;
|
||||
_resetButton.enabled = NO;
|
||||
_file1.text = @"";
|
||||
_file2.text = @"";
|
||||
_file3.text = @"";
|
||||
_zipButton.enabled = YES;
|
||||
_unzipButton.enabled = NO;
|
||||
_resetButton.enabled = NO;
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
- (NSString *)tempZipPath {
|
||||
NSString *path = [NSString stringWithFormat:@"%@/\%@.zip",
|
||||
NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0],
|
||||
[NSUUID UUID].UUIDString];
|
||||
return path;
|
||||
NSString *path = [NSString stringWithFormat:@"%@/\%@.zip",
|
||||
NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0],
|
||||
[NSUUID UUID].UUIDString];
|
||||
return path;
|
||||
}
|
||||
|
||||
- (NSString *)tempUnzipPath {
|
||||
NSString *path = [NSString stringWithFormat:@"%@/\%@",
|
||||
NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0],
|
||||
[NSUUID UUID].UUIDString];
|
||||
NSURL *url = [NSURL fileURLWithPath:path];
|
||||
NSError *error = nil;
|
||||
[[NSFileManager defaultManager] createDirectoryAtURL:url
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:&error];
|
||||
if (error) {
|
||||
return nil;
|
||||
}
|
||||
return url.path;
|
||||
NSString *path = [NSString stringWithFormat:@"%@/\%@",
|
||||
NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0],
|
||||
[NSUUID UUID].UUIDString];
|
||||
NSURL *url = [NSURL fileURLWithPath:path];
|
||||
NSError *error = nil;
|
||||
[[NSFileManager defaultManager] createDirectoryAtURL:url
|
||||
withIntermediateDirectories:YES
|
||||
attributes:nil
|
||||
error:&error];
|
||||
if (error) {
|
||||
return nil;
|
||||
}
|
||||
return url.path;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
17
ObjectiveCExample/ObjectiveCExampleTests/CancelDelegate.h
Normal file
17
ObjectiveCExample/ObjectiveCExampleTests/CancelDelegate.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// CancelDelegate.h
|
||||
// ObjectiveCExample
|
||||
//
|
||||
// Created by Antoine Cœur on 04/10/2017.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SSZipArchive.h"
|
||||
|
||||
@interface CancelDelegate : NSObject <SSZipArchiveDelegate>
|
||||
@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
|
||||
29
ObjectiveCExample/ObjectiveCExampleTests/CancelDelegate.m
Normal file
29
ObjectiveCExample/ObjectiveCExampleTests/CancelDelegate.m
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// CancelDelegate.m
|
||||
// ObjectiveCExample
|
||||
//
|
||||
// Created by Antoine Cœur on 04/10/2017.
|
||||
//
|
||||
|
||||
#import "CancelDelegate.h"
|
||||
|
||||
@implementation CancelDelegate
|
||||
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
|
||||
{
|
||||
_numFilesUnzipped = (int)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:(unsigned long long)loaded total:(unsigned long long)total
|
||||
{
|
||||
_loaded = (int)loaded;
|
||||
_total = (int)total;
|
||||
}
|
||||
@end
|
||||
@@ -7,11 +7,9 @@
|
||||
|
||||
#import "CollectingDelegate.h"
|
||||
|
||||
@implementation CollectingDelegate {
|
||||
|
||||
}
|
||||
@synthesize files = _files;
|
||||
@implementation CollectingDelegate
|
||||
|
||||
@synthesize files = _files;
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
@@ -21,11 +19,8 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath {
|
||||
[self.files addObject:entryPath];
|
||||
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath {
|
||||
[self.files addObject:unzippedFilePath];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
BIN
ObjectiveCExample/ObjectiveCExampleTests/Fixtures/Empty.zip
Normal file
BIN
ObjectiveCExample/ObjectiveCExampleTests/Fixtures/Empty.zip
Normal file
Binary file not shown.
17
ObjectiveCExample/ObjectiveCExampleTests/ProgressDelegate.h
Normal file
17
ObjectiveCExample/ObjectiveCExampleTests/ProgressDelegate.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// ProgressDelegate.h
|
||||
// ObjectiveCExample
|
||||
//
|
||||
// Created by Antoine Cœur on 04/10/2017.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SSZipArchive.h"
|
||||
|
||||
@interface ProgressDelegate : NSObject <SSZipArchiveDelegate>
|
||||
{
|
||||
@public
|
||||
NSMutableArray *progressEvents;
|
||||
}
|
||||
|
||||
@end
|
||||
46
ObjectiveCExample/ObjectiveCExampleTests/ProgressDelegate.m
Normal file
46
ObjectiveCExample/ObjectiveCExampleTests/ProgressDelegate.m
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// ProgressDelegate.m
|
||||
// ObjectiveCExample
|
||||
//
|
||||
// Created by Antoine Cœur on 04/10/2017.
|
||||
//
|
||||
|
||||
#import "ProgressDelegate.h"
|
||||
|
||||
@implementation ProgressDelegate
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = super.init;
|
||||
progressEvents = [NSMutableArray array];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (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:(unsigned long long)loaded total:(unsigned long long)total {
|
||||
NSLog(@"*** zipArchiveProgressEvent: loaded: `%llu` total: `%llu`", loaded, total);
|
||||
[progressEvents addObject:@(loaded)];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -11,46 +11,16 @@
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
#import "CollectingDelegate.h"
|
||||
#import "CancelDelegate.h"
|
||||
#import "ProgressDelegate.h"
|
||||
|
||||
@interface CancelDelegate : NSObject <SSZipArchiveDelegate>
|
||||
@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;
|
||||
@interface SSZipArchiveTests : XCTestCase
|
||||
@end
|
||||
|
||||
@implementation CancelDelegate
|
||||
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
|
||||
{
|
||||
_numFilesUnzipped = (int)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:(unsigned long long)loaded total:(unsigned long long)total
|
||||
{
|
||||
_loaded = (int)loaded;
|
||||
_total = (int)total;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface SSZipArchiveTests : XCTestCase <SSZipArchiveDelegate>
|
||||
@end
|
||||
|
||||
@implementation SSZipArchiveTests {
|
||||
NSMutableArray *progressEvents;
|
||||
}
|
||||
@implementation SSZipArchiveTests
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
progressEvents = [NSMutableArray array];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
@@ -107,23 +77,23 @@
|
||||
for (int test = 0; test < 20; test++)
|
||||
{
|
||||
// Zipping
|
||||
NSString *archivePath = [outputPath stringByAppendingPathComponent:[NSString stringWithFormat:@"queue_test_%d.zip",test]];
|
||||
NSString *archivePath = [outputPath stringByAppendingPathComponent:[NSString stringWithFormat:@"queue_test_%d.zip", test]];
|
||||
|
||||
BOOL success = [SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
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);
|
||||
XCTAssertTrue(fileSize > threshold, @"zipping failed at %@!", archivePath);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)testUnzipping {
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Regular"];
|
||||
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
@@ -133,11 +103,13 @@
|
||||
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"];
|
||||
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
@@ -147,21 +119,21 @@
|
||||
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];
|
||||
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
ProgressDelegate *delegate = [ProgressDelegate new];
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
// 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]);
|
||||
XCTAssertTrue(4 == [delegate->progressEvents count], @"Expected 4 progress events");
|
||||
XCTAssertTrue(0 == [delegate->progressEvents[0] intValue]);
|
||||
XCTAssertTrue(619 == [delegate->progressEvents[1] intValue]);
|
||||
XCTAssertTrue(1114 == [delegate->progressEvents[2] intValue]);
|
||||
XCTAssertTrue(1436 == [delegate->progressEvents[3] intValue]);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +142,8 @@
|
||||
NSString *outputPath = [self _cachesPath:@"Password"];
|
||||
|
||||
NSError *error = nil;
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd" error:&error delegate:self];
|
||||
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd" error:&error delegate:delegate];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
@@ -186,8 +159,9 @@
|
||||
NSString *outputPath = [self _cachesPath:@"Password"];
|
||||
|
||||
NSError *error = nil;
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd123" error:&error delegate:self];
|
||||
XCTAssertTrue(success);
|
||||
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd123" error:&error delegate:delegate];
|
||||
XCTAssertFalse(success);
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
|
||||
@@ -205,12 +179,11 @@
|
||||
|
||||
BOOL fileHasValidPassword = [SSZipArchive isPasswordValidForArchiveAtPath:zipPath password:@"passw0rd" error:&error];
|
||||
|
||||
XCTAssertTrue(fileHasValidPassword,@"Valid password reports false.");
|
||||
XCTAssertTrue(fileHasValidPassword, @"Valid password reports false.");
|
||||
|
||||
BOOL fileHasInvalidValidPassword = [SSZipArchive isPasswordValidForArchiveAtPath:zipPath password:@"passw0rd123" error:&error];
|
||||
|
||||
XCTAssertFalse(fileHasInvalidValidPassword,@"Invalid password reports true.");
|
||||
|
||||
XCTAssertFalse(fileHasInvalidValidPassword, @"Invalid password reports true.");
|
||||
}
|
||||
|
||||
- (void)testIsFilePasswordProtectedAtPath {
|
||||
@@ -249,7 +222,8 @@
|
||||
outputPath = [self _cachesPath:@"UnicodePassword"];
|
||||
|
||||
NSError *error = nil;
|
||||
success = [SSZipArchive unzipFileAtPath:archivePath toDestination:outputPath overwrite:YES password:@"ꊐ⌒Ⅳ🤐" error:&error delegate:self];
|
||||
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
|
||||
success = [SSZipArchive unzipFileAtPath:archivePath toDestination:outputPath overwrite:YES password:@"ꊐ⌒Ⅳ🤐" error:&error delegate:delegate];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
@@ -258,34 +232,34 @@
|
||||
|
||||
testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"];
|
||||
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped");
|
||||
|
||||
}
|
||||
|
||||
//Temp Disabled test, fix is not yet in the AES version of the unzip lib
|
||||
|
||||
//- (void)testUnzippingTruncatedFileFix {
|
||||
// NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"IncorrectHeaders" ofType:@"zip"];
|
||||
// NSString* outputPath = [self _cachesPath:@"IncorrectHeaders"];
|
||||
//
|
||||
// BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
// XCTAssertTrue(success);
|
||||
//
|
||||
// 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)testUnzippingTruncatedFileFix {
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"IncorrectHeaders" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"IncorrectHeaders"];
|
||||
|
||||
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
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"];
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"SymbolicLink" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"SymbolicLink"];
|
||||
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
NSString *testSymlink = [outputPath stringByAppendingPathComponent:@"SymbolicLink/Xcode.app"];
|
||||
@@ -299,10 +273,11 @@
|
||||
- (void)testUnzippingWithRelativeSymlink {
|
||||
|
||||
NSString *resourceName = @"RelativeSymbolicLink";
|
||||
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:resourceName ofType:@"zip"];
|
||||
NSString* outputPath = [self _cachesPath:resourceName];
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:resourceName ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:resourceName];
|
||||
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
// Determine where the symlinks are
|
||||
@@ -322,10 +297,11 @@
|
||||
|
||||
- (void)testUnzippingWithUnicodeFilenameInside {
|
||||
|
||||
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"Unicode" ofType:@"zip"];
|
||||
NSString* outputPath = [self _cachesPath:@"Unicode"];
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"Unicode" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Unicode"];
|
||||
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
bool unicodeFilenameWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Accént.txt"]];
|
||||
@@ -336,6 +312,14 @@
|
||||
XCTAssertTrue(unicodeFolderWasExtracted, @"Folders with names in unicode should be extracted propertly.");
|
||||
}
|
||||
|
||||
- (void)testUnzippingEmptyArchive {
|
||||
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"Empty" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Empty"];
|
||||
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:nil];
|
||||
XCTAssertTrue(success);
|
||||
}
|
||||
|
||||
- (void)testZippingAndUnzippingForDate {
|
||||
|
||||
@@ -351,12 +335,13 @@
|
||||
|
||||
BOOL success = [SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
|
||||
XCTAssertTrue(success);
|
||||
success = [SSZipArchive unzipFileAtPath:archivePath toDestination:outputPath delegate:self];
|
||||
id<SSZipArchiveDelegate> delegate = [ProgressDelegate new];
|
||||
success = [SSZipArchive unzipFileAtPath:archivePath toDestination:outputPath delegate:delegate];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
NSDictionary *createdFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[outputPath stringByAppendingPathComponent:@"Readme.markdown"] error:nil];
|
||||
|
||||
XCTAssertEqualObjects(originalFileAttributes[NSFileCreationDate], createdFileAttributes[@"NSFileCreationDate"], @"Orginal file creationDate should match created one");
|
||||
XCTAssertEqualObjects(originalFileAttributes[NSFileCreationDate], createdFileAttributes[@"NSFileCreationDate"], @"Original file creationDate should match created one");
|
||||
}
|
||||
|
||||
|
||||
@@ -428,7 +413,6 @@
|
||||
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
|
||||
@@ -450,42 +434,10 @@
|
||||
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:collector];
|
||||
XCTAssertTrue(success);
|
||||
|
||||
// STAssertEqualObjects([collector.files objectAtIndex:0], @"LICENSE.txt", nil);
|
||||
// STAssertEqualObjects([collector.files objectAtIndex:1], @"README.md", nil);
|
||||
XCTAssertEqualObjects(collector.files[0], [outputPath stringByAppendingString:@"/LICENSE"]);
|
||||
XCTAssertEqualObjects(collector.files[1], [outputPath stringByAppendingString:@"/Readme.markdown"]);
|
||||
}
|
||||
|
||||
#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:(unsigned long long)loaded total:(unsigned long long)total {
|
||||
NSLog(@"*** zipArchiveProgressEvent: loaded: `%llu` total: `%llu`", loaded, total);
|
||||
[progressEvents addObject:@(loaded)];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (NSString *)_cachesPath:(NSString *)directory {
|
||||
@@ -495,10 +447,7 @@
|
||||
path = [path stringByAppendingPathComponent:directory];
|
||||
}
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
if (![fileManager fileExistsAtPath:path]) {
|
||||
[fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
}
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
PODS:
|
||||
- SSZipArchive (2.0.8)
|
||||
- SSZipArchive (2.1.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- SSZipArchive (from `..`)
|
||||
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
|
||||
:path: ..
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
SSZipArchive: e6ab66e1936fac7e3b5073e9f5eb364d91dfbfc7
|
||||
SSZipArchive: 1e8e53dcb11bca3ded4738958dc49fc467320a14
|
||||
|
||||
PODFILE CHECKSUM: 5e250843c66c607960128ebfe02ab7d6569102be
|
||||
|
||||
|
||||
17
README.md
17
README.md
@@ -3,18 +3,21 @@
|
||||
|
||||
# SSZipArchive
|
||||
|
||||
ZipArchive is a simple utility class for zipping and unzipping files on iOS and Mac.
|
||||
ZipArchive is a simple utility class for zipping and unzipping files on iOS, macOS and tvOS.
|
||||
|
||||
- Unzip zip files;
|
||||
- Unzip password protected zip files;
|
||||
- Create new zip files;
|
||||
- Unzip AES encrypted zip files;
|
||||
- Create zip files;
|
||||
- Create password protected zip files;
|
||||
- Create AES encrypted zip files;
|
||||
- Choose compression level;
|
||||
- Append to existing zip files;
|
||||
- Zip files;
|
||||
- Zip-up NSData instances. (with a filename)
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
*The main release branch is configured to support Objective C and Swift 3+. There is a 'swift23' branch which is a tied to a older 1.x release and will not be upgraded. Xcode 8.3+ removes support for Swift 2.3*
|
||||
*The main release branch is configured to support Objective C and Swift 3+.*
|
||||
|
||||
SSZipArchive works on Xcode 7-9 and above, iOS 8-11 and above.
|
||||
|
||||
@@ -39,10 +42,10 @@ SSZipArchive requires ARC.
|
||||
|
||||
```objective-c
|
||||
// Create
|
||||
[SSZipArchive createZipFileAtPath: zipPath withContentsOfDirectory: sampleDataPath];
|
||||
[SSZipArchive createZipFileAtPath:zipPath withContentsOfDirectory:sampleDataPath];
|
||||
|
||||
// Unzip
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination: unzipPath];
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:unzipPath];
|
||||
```
|
||||
|
||||
### Swift
|
||||
@@ -57,7 +60,7 @@ 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](https://github.com/nmoinvaz/minizip) 1.1 is licensed under the [Zlib license](http://www.zlib.net/zlib_license.html).
|
||||
SSZipArchive is protected under the [MIT license](https://github.com/samsoffes/ssziparchive/raw/master/LICENSE) and our slightly modified version of [Minizip](https://github.com/nmoinvaz/minizip) 1.2 is licensed under the [Zlib license](http://www.zlib.net/zlib_license.html).
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'SSZipArchive'
|
||||
s.version = '2.0.8'
|
||||
s.version = '2.1.0'
|
||||
s.summary = 'Utility class for zipping and unzipping files on iOS, tvOS, watchOS, and Mac.'
|
||||
s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS, tvOS, watchOS, and Mac.'
|
||||
s.homepage = 'https://github.com/ZipArchive/ZipArchive'
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// SSZipArchive+Swift.swift
|
||||
// ZipArchive
|
||||
//
|
||||
// Created by William Dunay on 7/6/16.
|
||||
// Copyright © 2016 smumryak. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension SSZipArchive {
|
||||
|
||||
static func unzipFileAtPath(_ path: String, toDestination destination: String, overwrite: Bool, password: String?, delegate: SSZipArchiveDelegate?) throws -> Bool {
|
||||
|
||||
var success = false
|
||||
var error: NSError?
|
||||
|
||||
success = __unzipFile(atPath: path, toDestination: destination, overwrite: overwrite, password: password, error: &error, delegate: delegate)
|
||||
if let throwableError = error {
|
||||
throw throwableError
|
||||
}
|
||||
|
||||
return success
|
||||
}
|
||||
}
|
||||
@@ -59,17 +59,29 @@ typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
|
||||
|
||||
+ (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 * _Nullable error))completionHandler;
|
||||
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path
|
||||
toDestination:(NSString *)destination
|
||||
overwrite:(BOOL)overwrite
|
||||
password:(nullable NSString *)password
|
||||
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
|
||||
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path
|
||||
toDestination:(NSString *)destination
|
||||
preserveAttributes:(BOOL)preserveAttributes
|
||||
overwrite:(BOOL)overwrite
|
||||
nestedZipLevel:(NSInteger)nestedZipLevel
|
||||
password:(nullable NSString *)password
|
||||
error:(NSError **)error
|
||||
delegate:(nullable id<SSZipArchiveDelegate>)delegate
|
||||
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
|
||||
|
||||
// Zip
|
||||
// default compression level is Z_DEFAULT_COMPRESSION (from "zlib.h")
|
||||
|
||||
// without password
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths;
|
||||
@@ -77,7 +89,8 @@ typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
|
||||
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory;
|
||||
|
||||
// with password, password could be nil
|
||||
// with optional password, default encryption is AES
|
||||
// don't use AES if you need compatibility with native macOS unzip and Archive Utility
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password;
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(nullable NSString *)password;
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password;
|
||||
@@ -86,14 +99,28 @@ typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
|
||||
keepParentDirectory:(BOOL)keepParentDirectory
|
||||
withPassword:(nullable NSString *)password
|
||||
andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path
|
||||
withContentsOfDirectory:(NSString *)directoryPath
|
||||
keepParentDirectory:(BOOL)keepParentDirectory
|
||||
compressionLevel:(int)compressionLevel
|
||||
password:(nullable NSString *)password
|
||||
AES:(BOOL)aes
|
||||
progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (instancetype)initWithPath:(NSString *)path NS_DESIGNATED_INITIALIZER;
|
||||
- (BOOL)open;
|
||||
- (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password;
|
||||
|
||||
/// write empty folder
|
||||
- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password;
|
||||
/// write file
|
||||
- (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password;
|
||||
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName withPassword:(nullable NSString *)password;
|
||||
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
|
||||
/// write data
|
||||
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password;
|
||||
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
|
||||
|
||||
- (BOOL)close;
|
||||
|
||||
@end
|
||||
@@ -111,7 +138,6 @@ typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
|
||||
- (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
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
|
||||
#define CHUNK 16384
|
||||
|
||||
int _zipOpenEntry(zipFile entry, NSString *name, const zip_fileinfo *zipfi, int level, NSString *password, BOOL aes);
|
||||
BOOL _fileIsSymbolicLink(const unz_file_info *fileInfo);
|
||||
|
||||
#ifndef API_AVAILABLE
|
||||
// Xcode 7- compatibility
|
||||
#define API_AVAILABLE(...)
|
||||
@@ -54,7 +57,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
if (ret != UNZ_OK) {
|
||||
return NO;
|
||||
}
|
||||
unz_file_info fileInfo = {0};
|
||||
unz_file_info fileInfo = {};
|
||||
ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
|
||||
if (ret != UNZ_OK) {
|
||||
return NO;
|
||||
@@ -64,7 +67,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
|
||||
unzCloseCurrentFile(zip);
|
||||
ret = unzGoToNextFile(zip);
|
||||
} while (ret == UNZ_OK && UNZ_OK != UNZ_END_OF_LIST_OF_FILE);
|
||||
} while (ret == UNZ_OK);
|
||||
}
|
||||
|
||||
return NO;
|
||||
@@ -103,7 +106,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
unz_file_info fileInfo = {0};
|
||||
unz_file_info fileInfo = {};
|
||||
ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
|
||||
if (ret != UNZ_OK) {
|
||||
if (error) {
|
||||
@@ -116,7 +119,8 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
unsigned char buffer[10] = {0};
|
||||
int readBytes = unzReadCurrentFile(zip, buffer, (unsigned)MIN(10UL,fileInfo.uncompressed_size));
|
||||
if (readBytes < 0) {
|
||||
// Let's assume the invalid password caused this error
|
||||
// Let's assume error Z_DATA_ERROR is caused by an invalid password
|
||||
// Let's assume other errors are caused by Content Not Readable
|
||||
if (readBytes != Z_DATA_ERROR) {
|
||||
if (error) {
|
||||
*error = [NSError errorWithDomain:SSZipArchiveErrorDomain
|
||||
@@ -131,9 +135,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
|
||||
unzCloseCurrentFile(zip);
|
||||
ret = unzGoToNextFile(zip);
|
||||
} while (ret == UNZ_OK && UNZ_OK != UNZ_END_OF_LIST_OF_FILE);
|
||||
} while (ret == UNZ_OK);
|
||||
}
|
||||
|
||||
|
||||
// No password required
|
||||
return YES;
|
||||
}
|
||||
@@ -177,8 +181,8 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
|
||||
+ (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 * _Nullable error))completionHandler
|
||||
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler
|
||||
{
|
||||
return [self unzipFileAtPath:path toDestination:destination preserveAttributes:YES overwrite:YES password:nil error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler];
|
||||
}
|
||||
@@ -200,9 +204,23 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
overwrite:(BOOL)overwrite
|
||||
password:(nullable NSString *)password
|
||||
error:(NSError **)error
|
||||
delegate:(id<SSZipArchiveDelegate>)delegate
|
||||
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler
|
||||
delegate:(nullable id<SSZipArchiveDelegate>)delegate
|
||||
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler
|
||||
{
|
||||
return [self unzipFileAtPath:path toDestination:destination preserveAttributes:preserveAttributes overwrite:overwrite nestedZipLevel:0 password:password error:error delegate:delegate progressHandler:progressHandler completionHandler:completionHandler];
|
||||
}
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path
|
||||
toDestination:(NSString *)destination
|
||||
preserveAttributes:(BOOL)preserveAttributes
|
||||
overwrite:(BOOL)overwrite
|
||||
nestedZipLevel:(NSInteger)nestedZipLevel
|
||||
password:(nullable NSString *)password
|
||||
error:(NSError **)error
|
||||
delegate:(nullable id<SSZipArchiveDelegate>)delegate
|
||||
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler
|
||||
{
|
||||
// Guard against empty strings
|
||||
if (path.length == 0 || destination.length == 0)
|
||||
@@ -241,11 +259,13 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
unsigned long long fileSize = [fileAttributes[NSFileSize] unsignedLongLongValue];
|
||||
unsigned long long currentPosition = 0;
|
||||
|
||||
unz_global_info globalInfo = {0ul, 0ul};
|
||||
unz_global_info globalInfo = {};
|
||||
unzGetGlobalInfo(zip, &globalInfo);
|
||||
|
||||
// Begin unzipping
|
||||
if (unzGoToFirstFile(zip) != UNZ_OK)
|
||||
int ret = 0;
|
||||
ret = unzGoToFirstFile(zip);
|
||||
if (ret != UNZ_OK && ret != UNZ_END_OF_LIST_OF_FILE)
|
||||
{
|
||||
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open first file in zip file"};
|
||||
NSError *err = [NSError errorWithDomain:SSZipArchiveErrorDomain code:SSZipArchiveErrorCodeFailedOpenFileInZip userInfo:userInfo];
|
||||
@@ -262,7 +282,6 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
|
||||
BOOL success = YES;
|
||||
BOOL canceled = NO;
|
||||
int ret = 0;
|
||||
int crc_ret = 0;
|
||||
unsigned char buffer[4096] = {0};
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
@@ -276,9 +295,12 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
[delegate zipArchiveProgressEvent:currentPosition total:fileSize];
|
||||
}
|
||||
|
||||
NSInteger currentFileNumber = 0;
|
||||
NSInteger currentFileNumber = -1;
|
||||
NSError *unzippingError;
|
||||
do {
|
||||
currentFileNumber++;
|
||||
if (ret == UNZ_END_OF_LIST_OF_FILE)
|
||||
break;
|
||||
@autoreleasepool {
|
||||
if (password.length == 0) {
|
||||
ret = unzOpenCurrentFile(zip);
|
||||
@@ -310,7 +332,8 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
if ([delegate respondsToSelector:@selector(zipArchiveShouldUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) {
|
||||
if (![delegate zipArchiveShouldUnzipFileAtIndex:currentFileNumber
|
||||
totalFiles:(NSInteger)globalInfo.number_entry
|
||||
archivePath:path fileInfo:fileInfo]) {
|
||||
archivePath:path
|
||||
fileInfo:fileInfo]) {
|
||||
success = NO;
|
||||
canceled = YES;
|
||||
break;
|
||||
@@ -334,54 +357,14 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
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 = _fileIsSymbolicLink(&fileInfo);
|
||||
|
||||
BOOL fileIsSymbolicLink = NO;
|
||||
if (((fileInfo.version >> 8) == ZipUNIXVersion) && BSD_IFLNK == (BSD_SFMT & (fileInfo.external_fa >> 16))) {
|
||||
fileIsSymbolicLink = YES;
|
||||
}
|
||||
|
||||
NSString * strPath = @(filename);
|
||||
if (!strPath) {
|
||||
// if filename is non-unicode, detect and transform Encoding
|
||||
NSData *data = [NSData dataWithBytes:(const void *)filename length:sizeof(unsigned char) * fileInfo.size_filename];
|
||||
#ifdef __MAC_10_13
|
||||
// Xcode 9+
|
||||
if (@available(macOS 10.10, iOS 8.0, watchOS 2.0, tvOS 9.0, *)) {
|
||||
#else
|
||||
// Xcode 8-
|
||||
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_9_2) {
|
||||
#endif
|
||||
// supported encodings are in [NSString availableStringEncodings]
|
||||
[NSString stringEncodingForData:data encodingOptions:nil convertedString:&strPath usedLossyConversion:nil];
|
||||
} else {
|
||||
// fallback to a simple manual detect for macOS 10.9 or older
|
||||
NSArray<NSNumber *> *encodings = @[@(kCFStringEncodingGB_18030_2000), @(kCFStringEncodingShiftJIS)];
|
||||
for (NSNumber *encoding in encodings) {
|
||||
strPath = [NSString stringWithCString:filename encoding:(NSStringEncoding)CFStringConvertEncodingToNSStringEncoding(encoding.unsignedIntValue)];
|
||||
if (strPath) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!strPath) {
|
||||
// if filename encoding is non-detected, we default to something based on data
|
||||
// _hexString is more readable than _base64RFC4648 for debugging unknown encodings
|
||||
strPath = [data _hexString];
|
||||
}
|
||||
NSString * strPath = [SSZipArchive _filenameStringWithCString:filename size:fileInfo.size_filename];
|
||||
if ([strPath hasPrefix:@"__MACOSX/"]) {
|
||||
// ignoring resource forks: https://superuser.com/questions/104500/what-is-macosx-folder
|
||||
unzCloseCurrentFile(zip);
|
||||
ret = unzGoToNextFile(zip);
|
||||
continue;
|
||||
}
|
||||
if (!strPath.length) {
|
||||
// if filename data is unsalvageable, we default to currentFileNumber
|
||||
@@ -409,7 +392,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
[directoriesModificationDates addObject: @{@"path": fullPath, @"modDate": modDate}];
|
||||
}
|
||||
if (isDirectory) {
|
||||
[fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err];
|
||||
[fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err];
|
||||
} else {
|
||||
[fileManager createDirectoryAtPath:fullPath.stringByDeletingLastPathComponent withIntermediateDirectories:YES attributes:directoryAttr error:&err];
|
||||
}
|
||||
@@ -451,25 +434,37 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
break;
|
||||
}
|
||||
readBytes = unzReadCurrentFile(zip, buffer, 4096);
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
if (readBytes < 0) {
|
||||
// Let's assume error Z_DATA_ERROR is caused by an invalid password
|
||||
// Let's assume other errors are caused by Content Not Readable
|
||||
success = NO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (fp) {
|
||||
fclose(fp);
|
||||
|
||||
if (preserveAttributes) {
|
||||
|
||||
|
||||
if (nestedZipLevel
|
||||
&& [fullPath.pathExtension.lowercaseString isEqualToString:@"zip"]
|
||||
&& [self unzipFileAtPath:fullPath
|
||||
toDestination:fullPath.stringByDeletingLastPathComponent
|
||||
preserveAttributes:preserveAttributes
|
||||
overwrite:overwrite
|
||||
nestedZipLevel:nestedZipLevel - 1
|
||||
password:password
|
||||
error:nil
|
||||
delegate:nil
|
||||
progressHandler:nil
|
||||
completionHandler:nil]) {
|
||||
[directoriesModificationDates removeLastObject];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil];
|
||||
} else if (preserveAttributes) {
|
||||
|
||||
// Set the original datetime property
|
||||
if (fileInfo.dos_date != 0) {
|
||||
NSDate *orgDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dos_date];
|
||||
NSDictionary *attr = @{NSFileModificationDate: orgDate};
|
||||
|
||||
|
||||
if (attr) {
|
||||
if (![fileManager setAttributes:attr ofItemAtPath:fullPath error:nil]) {
|
||||
// Can't set attributes
|
||||
@@ -477,19 +472,19 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set the original permissions on the file (+read/write to solve #293)
|
||||
uLong permissions = fileInfo.external_fa >> 16 | 0b110000000;
|
||||
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]) {
|
||||
// Unable to set the permissions attribute
|
||||
@@ -511,6 +506,11 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Let's assume error Z_DATA_ERROR is caused by an invalid password
|
||||
// Let's assume other errors are caused by Content Not Readable
|
||||
success = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -520,9 +520,15 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
int bytesRead = 0;
|
||||
while ((bytesRead = unzReadCurrentFile(zip, buffer, 4096)) > 0)
|
||||
{
|
||||
buffer[bytesRead] = (int)0;
|
||||
buffer[bytesRead] = 0;
|
||||
[destinationPath appendString:@((const char *)buffer)];
|
||||
}
|
||||
if (bytesRead < 0) {
|
||||
// Let's assume error Z_DATA_ERROR is caused by an invalid password
|
||||
// Let's assume other errors are caused by Content Not Readable
|
||||
success = NO;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check if the symlink exists and delete it if we're overwriting
|
||||
if (overwrite)
|
||||
@@ -557,7 +563,7 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
|
||||
crc_ret = unzCloseCurrentFile(zip);
|
||||
if (crc_ret == UNZ_CRCERROR) {
|
||||
//CRC ERROR
|
||||
// CRC ERROR
|
||||
success = NO;
|
||||
break;
|
||||
}
|
||||
@@ -572,7 +578,6 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
archivePath:path unzippedFilePath: fullPath];
|
||||
}
|
||||
|
||||
currentFileNumber++;
|
||||
if (progressHandler)
|
||||
{
|
||||
progressHandler(strPath, fileInfo, currentFileNumber, globalInfo.number_entry);
|
||||
@@ -680,6 +685,16 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
keepParentDirectory:(BOOL)keepParentDirectory
|
||||
withPassword:(nullable NSString *)password
|
||||
andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler {
|
||||
return [self createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:keepParentDirectory compressionLevel:Z_DEFAULT_COMPRESSION password:password AES:YES progressHandler:progressHandler];
|
||||
}
|
||||
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path
|
||||
withContentsOfDirectory:(NSString *)directoryPath
|
||||
keepParentDirectory:(BOOL)keepParentDirectory
|
||||
compressionLevel:(int)compressionLevel
|
||||
password:(nullable NSString *)password
|
||||
AES:(BOOL)aes
|
||||
progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler {
|
||||
|
||||
SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path];
|
||||
BOOL success = [zipArchive open];
|
||||
@@ -701,15 +716,13 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
}
|
||||
|
||||
if (!isDir) {
|
||||
success &= [zipArchive writeFileAtPath:fullFilePath withFileName:fileName withPassword:password];
|
||||
success &= [zipArchive writeFileAtPath:fullFilePath withFileName:fileName compressionLevel:compressionLevel password:password AES:aes];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([[NSFileManager defaultManager] subpathsOfDirectoryAtPath:fullFilePath error:nil].count == 0)
|
||||
{
|
||||
NSString *tempFilePath = [self _temporaryPathForDiscardableFile];
|
||||
NSString *tempFileFilename = [fileName stringByAppendingPathComponent:tempFilePath.lastPathComponent];
|
||||
success &= [zipArchive writeFileAtPath:tempFilePath withFileName:tempFileFilename withPassword:password];
|
||||
success &= [zipArchive writeFolderAtPath:fullFilePath withFolderName:fileName withPassword:password];
|
||||
}
|
||||
}
|
||||
complete++;
|
||||
@@ -742,8 +755,178 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
return (NULL != _zip);
|
||||
}
|
||||
|
||||
- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password
|
||||
{
|
||||
NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened");
|
||||
|
||||
zip_fileinfo zipInfo = {};
|
||||
|
||||
[SSZipArchive zipInfo:&zipInfo setAttributesOfItemAtPath:path];
|
||||
|
||||
int error = _zipOpenEntry(_zip, [folderName stringByAppendingString:@"/"], &zipInfo, Z_NO_COMPRESSION, password, 0);
|
||||
const void *buffer = NULL;
|
||||
zipWriteInFileInZip(_zip, buffer, 0);
|
||||
zipCloseFileInZip(_zip);
|
||||
return error == ZIP_OK;
|
||||
}
|
||||
|
||||
- (void)zipInfo:(zip_fileinfo *)zipInfo setDate:(NSDate *)date
|
||||
- (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password
|
||||
{
|
||||
return [self writeFileAtPath:path withFileName:nil withPassword:password];
|
||||
}
|
||||
|
||||
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName withPassword:(nullable NSString *)password
|
||||
{
|
||||
return [self writeFileAtPath:path withFileName:fileName compressionLevel:Z_DEFAULT_COMPRESSION password:password AES:YES];
|
||||
}
|
||||
|
||||
// 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:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes
|
||||
{
|
||||
NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened");
|
||||
|
||||
FILE *input = fopen(path.fileSystemRepresentation, "r");
|
||||
if (NULL == input) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (!fileName) {
|
||||
fileName = path.lastPathComponent;
|
||||
}
|
||||
|
||||
zip_fileinfo zipInfo = {};
|
||||
|
||||
[SSZipArchive zipInfo:&zipInfo setAttributesOfItemAtPath:path];
|
||||
|
||||
void *buffer = malloc(CHUNK);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
fclose(input);
|
||||
return NO;
|
||||
}
|
||||
|
||||
int error = _zipOpenEntry(_zip, fileName, &zipInfo, compressionLevel, password, aes);
|
||||
|
||||
while (!feof(input) && !ferror(input))
|
||||
{
|
||||
unsigned int len = (unsigned int) fread(buffer, 1, CHUNK, input);
|
||||
zipWriteInFileInZip(_zip, buffer, len);
|
||||
}
|
||||
|
||||
zipCloseFileInZip(_zip);
|
||||
free(buffer);
|
||||
fclose(input);
|
||||
return error == ZIP_OK;
|
||||
}
|
||||
|
||||
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password
|
||||
{
|
||||
return [self writeData:data filename:filename compressionLevel:Z_DEFAULT_COMPRESSION password:password AES:YES];
|
||||
}
|
||||
|
||||
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes
|
||||
{
|
||||
if (!_zip) {
|
||||
return NO;
|
||||
}
|
||||
if (!data) {
|
||||
return NO;
|
||||
}
|
||||
zip_fileinfo zipInfo = {};
|
||||
[SSZipArchive zipInfo:&zipInfo setDate:[NSDate date]];
|
||||
|
||||
int error = _zipOpenEntry(_zip, filename, &zipInfo, compressionLevel, password, aes);
|
||||
|
||||
zipWriteInFileInZip(_zip, data.bytes, (unsigned int)data.length);
|
||||
|
||||
zipCloseFileInZip(_zip);
|
||||
return error == ZIP_OK;
|
||||
}
|
||||
|
||||
- (BOOL)close
|
||||
{
|
||||
NSAssert((_zip != NULL), @"[SSZipArchive] Attempting to close an archive which was never opened");
|
||||
int error = zipClose(_zip, NULL);
|
||||
_zip = nil;
|
||||
return error == UNZ_OK;
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
+ (NSString *)_filenameStringWithCString:(const char *)filename size:(uint16_t)size_filename
|
||||
{
|
||||
NSString * strPath = @(filename);
|
||||
if (strPath) {
|
||||
return strPath;
|
||||
}
|
||||
// if filename is non-unicode, detect and transform Encoding
|
||||
NSData *data = [NSData dataWithBytes:(const void *)filename length:sizeof(unsigned char) * size_filename];
|
||||
#ifdef __MAC_10_13
|
||||
// Xcode 9+
|
||||
if (@available(macOS 10.10, iOS 8.0, watchOS 2.0, tvOS 9.0, *)) {
|
||||
// supported encodings are in [NSString availableStringEncodings]
|
||||
[NSString stringEncodingForData:data encodingOptions:nil convertedString:&strPath usedLossyConversion:nil];
|
||||
}
|
||||
#else
|
||||
// Xcode 8-
|
||||
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_9_2) {
|
||||
// supported encodings are in [NSString availableStringEncodings]
|
||||
[NSString stringEncodingForData:data encodingOptions:nil convertedString:&strPath usedLossyConversion:nil];
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
// fallback to a simple manual detect for macOS 10.9 or older
|
||||
NSArray<NSNumber *> *encodings = @[@(kCFStringEncodingGB_18030_2000), @(kCFStringEncodingShiftJIS)];
|
||||
for (NSNumber *encoding in encodings) {
|
||||
strPath = [NSString stringWithCString:filename encoding:(NSStringEncoding)CFStringConvertEncodingToNSStringEncoding(encoding.unsignedIntValue)];
|
||||
if (strPath) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!strPath) {
|
||||
// if filename encoding is non-detected, we default to something based on data
|
||||
// _hexString is more readable than _base64RFC4648 for debugging unknown encodings
|
||||
strPath = [data _hexString];
|
||||
}
|
||||
return strPath;
|
||||
}
|
||||
|
||||
+ (void)zipInfo:(zip_fileinfo *)zipInfo setAttributesOfItemAtPath:(NSString *)path
|
||||
{
|
||||
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 != nil) {
|
||||
// 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
|
||||
|
||||
// Casted back to an unsigned int to match type of external_fa in minizip
|
||||
zipInfo->external_fa = (unsigned int)(permissionsLong << 16L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)zipInfo:(zip_fileinfo *)zipInfo setDate:(NSDate *)date
|
||||
{
|
||||
NSCalendar *currentCalendar = SSZipArchive._gregorian;
|
||||
NSCalendarUnit flags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
|
||||
@@ -760,173 +943,6 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
zipInfo->dos_date = tm_to_dosdate(&tmz_date);
|
||||
}
|
||||
|
||||
- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password
|
||||
{
|
||||
NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened");
|
||||
|
||||
zip_fileinfo zipInfo = {0,0,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 != nil) {
|
||||
// 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
|
||||
|
||||
// Casted back to an unsigned int to match type of external_fa in minizip
|
||||
zipInfo.external_fa = (unsigned int)(permissionsLong << 16L);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int len = 0;
|
||||
zipOpenNewFileInZip3(_zip, [folderName stringByAppendingString:@"/"].fileSystemRepresentation, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_NO_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL,
|
||||
Z_DEFAULT_STRATEGY, password.UTF8String, 0);
|
||||
zipWriteInFileInZip(_zip, &len, 0);
|
||||
zipCloseFileInZip(_zip);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password;
|
||||
{
|
||||
return [self writeFileAtPath:path withFileName:nil withPassword:password];
|
||||
}
|
||||
|
||||
// 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:(nullable NSString *)fileName withPassword:(nullable NSString *)password
|
||||
{
|
||||
NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened");
|
||||
|
||||
FILE *input = fopen(path.fileSystemRepresentation, "r");
|
||||
if (NULL == input) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
const char *aFileName;
|
||||
if (!fileName) {
|
||||
aFileName = path.lastPathComponent.fileSystemRepresentation;
|
||||
}
|
||||
else {
|
||||
aFileName = fileName.fileSystemRepresentation;
|
||||
}
|
||||
|
||||
zip_fileinfo zipInfo = {0,0,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 != nil) {
|
||||
// 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
|
||||
|
||||
// Casted back to an unsigned int to match type of external_fa in minizip
|
||||
zipInfo.external_fa = (unsigned int)(permissionsLong << 16L);
|
||||
}
|
||||
}
|
||||
|
||||
void *buffer = malloc(CHUNK);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
zipOpenNewFileInZip3(_zip, aFileName, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, password.UTF8String, 0);
|
||||
unsigned int len = 0;
|
||||
|
||||
while (!feof(input) && !ferror(input))
|
||||
{
|
||||
len = (unsigned int) fread(buffer, 1, CHUNK, input);
|
||||
zipWriteInFileInZip(_zip, buffer, len);
|
||||
}
|
||||
|
||||
zipCloseFileInZip(_zip);
|
||||
free(buffer);
|
||||
fclose(input);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password;
|
||||
{
|
||||
if (!_zip) {
|
||||
return NO;
|
||||
}
|
||||
if (!data) {
|
||||
return NO;
|
||||
}
|
||||
zip_fileinfo zipInfo = {0,0,0};
|
||||
[self zipInfo:&zipInfo setDate:[NSDate date]];
|
||||
|
||||
zipOpenNewFileInZip3(_zip, filename.fileSystemRepresentation, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, password.UTF8String, 0);
|
||||
|
||||
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");
|
||||
int error = zipClose(_zip, NULL);
|
||||
_zip = nil;
|
||||
return error == UNZ_OK;
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
+ (NSString *)_temporaryPathForDiscardableFile
|
||||
{
|
||||
static NSString *discardableFileName = @".DS_Store";
|
||||
static NSString *discardableFilePath = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
NSString *temporaryDirectoryName = [NSUUID UUID].UUIDString;
|
||||
NSString *temporaryDirectory = [NSTemporaryDirectory() stringByAppendingPathComponent:temporaryDirectoryName];
|
||||
BOOL directoryCreated = [[NSFileManager defaultManager] createDirectoryAtPath:temporaryDirectory withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
if (directoryCreated) {
|
||||
discardableFilePath = [temporaryDirectory stringByAppendingPathComponent:discardableFileName];
|
||||
[@"" writeToFile:discardableFilePath atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
||||
}
|
||||
});
|
||||
return discardableFilePath;
|
||||
}
|
||||
|
||||
+ (NSCalendar *)_gregorian
|
||||
{
|
||||
static NSCalendar *gregorian;
|
||||
@@ -947,11 +963,9 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
// 7423 = 0111 0100 0010 0011 - 01110 100001 00011 = 14 33 3 = 14:33:06
|
||||
+ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime
|
||||
{
|
||||
/*
|
||||
// the whole `_dateWithMSDOSFormat:` method is equivalent but faster than this one line,
|
||||
// essentially because `mktime` is slow:
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSince1970:dosdate_to_time_t(msdosDateTime)];
|
||||
*/
|
||||
// the whole `_dateWithMSDOSFormat:` method is equivalent but faster than this one line,
|
||||
// essentially because `mktime` is slow:
|
||||
//NSDate *date = [NSDate dateWithTimeIntervalSince1970:dosdate_to_time_t(msdosDateTime)];
|
||||
static const UInt32 kYearMask = 0xFE000000;
|
||||
static const UInt32 kMonthMask = 0x1E00000;
|
||||
static const UInt32 kDayMask = 0x1F0000;
|
||||
@@ -962,7 +976,6 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
NSAssert(0xFFFFFFFF == (kYearMask | kMonthMask | kDayMask | kHourMask | kMinuteMask | kSecondMask), @"[SSZipArchive] MSDOS date masks don't add up");
|
||||
|
||||
NSDateComponents *components = [[NSDateComponents alloc] init];
|
||||
|
||||
components.year = 1980 + ((msdosDateTime & kYearMask) >> 25);
|
||||
components.month = (msdosDateTime & kMonthMask) >> 21;
|
||||
components.day = (msdosDateTime & kDayMask) >> 16;
|
||||
@@ -976,7 +989,35 @@ NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain";
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - Private tools for unreadable data
|
||||
int _zipOpenEntry(zipFile entry, NSString *name, const zip_fileinfo *zipfi, int level, NSString *password, BOOL aes)
|
||||
{
|
||||
return zipOpenNewFileInZip5(entry, name.fileSystemRepresentation, zipfi, NULL, 0, NULL, 0, NULL, 0, 0, Z_DEFLATED, level, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, password.UTF8String, aes);
|
||||
}
|
||||
|
||||
#pragma mark - Private tools for file info
|
||||
|
||||
BOOL _fileIsSymbolicLink(const unz_file_info *fileInfo)
|
||||
{
|
||||
//
|
||||
// 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 = ((fileInfo->version >> 8) == ZipUNIXVersion) && BSD_IFLNK == (BSD_SFMT & (fileInfo->external_fa >> 16));
|
||||
return fileIsSymbolicLink;
|
||||
}
|
||||
|
||||
#pragma mark - Private tools for unreadable encodings
|
||||
|
||||
@implementation NSData (SSZipArchive)
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def *p_filef
|
||||
p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file;
|
||||
}
|
||||
|
||||
static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char *filename, int mode);
|
||||
static voidpf ZCALLBACK fopen_file_func(ZIP_UNUSED voidpf opaque, const char *filename, int mode);
|
||||
static uint32_t ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uint32_t size);
|
||||
static uint32_t ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void *buf, uint32_t size);
|
||||
static uint64_t ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream);
|
||||
@@ -109,7 +109,7 @@ static voidpf file_build_ioposix(FILE *file, const char *filename)
|
||||
return (voidpf)ioposix;
|
||||
}
|
||||
|
||||
static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char *filename, int mode)
|
||||
static voidpf ZCALLBACK fopen_file_func(ZIP_UNUSED voidpf opaque, const char *filename, int mode)
|
||||
{
|
||||
FILE* file = NULL;
|
||||
const char *mode_fopen = NULL;
|
||||
@@ -128,7 +128,7 @@ static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char *filename, int
|
||||
return file;
|
||||
}
|
||||
|
||||
static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void *filename, int mode)
|
||||
static voidpf ZCALLBACK fopen64_file_func(ZIP_UNUSED voidpf opaque, const void *filename, int mode)
|
||||
{
|
||||
FILE* file = NULL;
|
||||
const char *mode_fopen = NULL;
|
||||
@@ -197,7 +197,7 @@ static voidpf ZCALLBACK fopendisk_file_func(voidpf opaque, voidpf stream, uint32
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint32_t ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uint32_t size)
|
||||
static uint32_t ZCALLBACK fread_file_func(ZIP_UNUSED voidpf opaque, voidpf stream, void* buf, uint32_t size)
|
||||
{
|
||||
FILE_IOPOSIX *ioposix = NULL;
|
||||
uint32_t read = (uint32_t)-1;
|
||||
@@ -208,7 +208,7 @@ static uint32_t ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* bu
|
||||
return read;
|
||||
}
|
||||
|
||||
static uint32_t ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void *buf, uint32_t size)
|
||||
static uint32_t ZCALLBACK fwrite_file_func(ZIP_UNUSED voidpf opaque, voidpf stream, const void *buf, uint32_t size)
|
||||
{
|
||||
FILE_IOPOSIX *ioposix = NULL;
|
||||
uint32_t written = (uint32_t)-1;
|
||||
@@ -219,7 +219,7 @@ static uint32_t ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const v
|
||||
return written;
|
||||
}
|
||||
|
||||
static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream)
|
||||
static long ZCALLBACK ftell_file_func(ZIP_UNUSED voidpf opaque, voidpf stream)
|
||||
{
|
||||
FILE_IOPOSIX *ioposix = NULL;
|
||||
long ret = -1;
|
||||
@@ -230,7 +230,7 @@ static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint64_t ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream)
|
||||
static uint64_t ZCALLBACK ftell64_file_func(ZIP_UNUSED voidpf opaque, voidpf stream)
|
||||
{
|
||||
FILE_IOPOSIX *ioposix = NULL;
|
||||
uint64_t ret = (uint64_t)-1;
|
||||
@@ -241,7 +241,7 @@ static uint64_t ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uint32_t offset, int origin)
|
||||
static long ZCALLBACK fseek_file_func(ZIP_UNUSED voidpf opaque, voidpf stream, uint32_t offset, int origin)
|
||||
{
|
||||
FILE_IOPOSIX *ioposix = NULL;
|
||||
int fseek_origin = 0;
|
||||
@@ -270,7 +270,7 @@ static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uint32_t off
|
||||
return ret;
|
||||
}
|
||||
|
||||
static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, uint64_t offset, int origin)
|
||||
static long ZCALLBACK fseek64_file_func(ZIP_UNUSED voidpf opaque, voidpf stream, uint64_t offset, int origin)
|
||||
{
|
||||
FILE_IOPOSIX *ioposix = NULL;
|
||||
int fseek_origin = 0;
|
||||
@@ -301,7 +301,7 @@ static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, uint64_t o
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream)
|
||||
static int ZCALLBACK fclose_file_func(ZIP_UNUSED voidpf opaque, voidpf stream)
|
||||
{
|
||||
FILE_IOPOSIX *ioposix = NULL;
|
||||
int ret = -1;
|
||||
@@ -315,7 +315,7 @@ static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream)
|
||||
static int ZCALLBACK ferror_file_func(ZIP_UNUSED voidpf opaque, voidpf stream)
|
||||
{
|
||||
FILE_IOPOSIX *ioposix = NULL;
|
||||
int ret = -1;
|
||||
|
||||
@@ -22,6 +22,12 @@
|
||||
|
||||
#include "zlib.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define ZIP_UNUSED __attribute__((__unused__))
|
||||
#else
|
||||
# define ZIP_UNUSED
|
||||
#endif
|
||||
|
||||
#if defined(USE_FILE32API)
|
||||
# define fopen64 fopen
|
||||
# define ftello64 ftell
|
||||
|
||||
@@ -39,16 +39,16 @@
|
||||
#ifdef __GNUC__
|
||||
#ifndef max
|
||||
#define max(x,y) ({ \
|
||||
const typeof(x) _x = (x); \
|
||||
const typeof(y) _y = (y); \
|
||||
const __typeof__(x) _x = (x); \
|
||||
const __typeof__(y) _y = (y); \
|
||||
(void) (&_x == &_y); \
|
||||
_x > _y ? _x : _y; })
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifndef min
|
||||
#define min(x,y) ({ \
|
||||
const typeof(x) _x = (x); \
|
||||
const typeof(y) _y = (y); \
|
||||
const __typeof__(x) _x = (x); \
|
||||
const __typeof__(y) _y = (y); \
|
||||
(void) (&_x == &_y); \
|
||||
_x < _y ? _x : _y; })
|
||||
#endif
|
||||
@@ -75,7 +75,7 @@ typedef struct ourstream_s {
|
||||
# define print_buf(o,s,f,...)
|
||||
#endif
|
||||
|
||||
void print_buf_internal(voidpf opaque, voidpf stream, char *format, ...)
|
||||
void print_buf_internal(ZIP_UNUSED voidpf opaque, voidpf stream, char *format, ...)
|
||||
{
|
||||
ourstream_t *streamio = (ourstream_t *)stream;
|
||||
va_list arglist;
|
||||
@@ -85,7 +85,7 @@ void print_buf_internal(voidpf opaque, voidpf stream, char *format, ...)
|
||||
va_end(arglist);
|
||||
}
|
||||
|
||||
voidpf fopen_buf_internal_func(voidpf opaque, voidpf stream, uint32_t number_disk, int mode)
|
||||
voidpf fopen_buf_internal_func(ZIP_UNUSED voidpf opaque, voidpf stream, ZIP_UNUSED uint32_t number_disk, ZIP_UNUSED int mode)
|
||||
{
|
||||
ourstream_t *streamio = NULL;
|
||||
if (stream == NULL)
|
||||
@@ -280,7 +280,7 @@ uint32_t ZCALLBACK fwrite_buf_func(voidpf opaque, voidpf stream, const void *buf
|
||||
return size - bytes_left_to_write;
|
||||
}
|
||||
|
||||
uint64_t ftell_buf_internal_func(voidpf opaque, voidpf stream, uint64_t position)
|
||||
uint64_t ftell_buf_internal_func(ZIP_UNUSED voidpf opaque, voidpf stream, uint64_t position)
|
||||
{
|
||||
ourstream_t *streamio = (ourstream_t *)stream;
|
||||
streamio->position = position;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
# define IOMEM_BUFFERSIZE (UINT16_MAX)
|
||||
#endif
|
||||
|
||||
voidpf ZCALLBACK fopen_mem_func(voidpf opaque, const char *filename, int mode)
|
||||
voidpf ZCALLBACK fopen_mem_func(voidpf opaque, ZIP_UNUSED const char *filename, int mode)
|
||||
{
|
||||
ourmemory_t *mem = (ourmemory_t *)opaque;
|
||||
if (mem == NULL)
|
||||
@@ -59,13 +59,13 @@ voidpf ZCALLBACK fopen_mem_func(voidpf opaque, const char *filename, int mode)
|
||||
return mem;
|
||||
}
|
||||
|
||||
voidpf ZCALLBACK fopendisk_mem_func(voidpf opaque, voidpf stream, uint32_t number_disk, int mode)
|
||||
voidpf ZCALLBACK fopendisk_mem_func(ZIP_UNUSED voidpf opaque, ZIP_UNUSED voidpf stream, ZIP_UNUSED uint32_t number_disk, ZIP_UNUSED int mode)
|
||||
{
|
||||
/* Not used */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32_t ZCALLBACK fread_mem_func(voidpf opaque, voidpf stream, void *buf, uint32_t size)
|
||||
uint32_t ZCALLBACK fread_mem_func(ZIP_UNUSED voidpf opaque, voidpf stream, void *buf, uint32_t size)
|
||||
{
|
||||
ourmemory_t *mem = (ourmemory_t *)stream;
|
||||
|
||||
@@ -78,7 +78,7 @@ uint32_t ZCALLBACK fread_mem_func(voidpf opaque, voidpf stream, void *buf, uint3
|
||||
return size;
|
||||
}
|
||||
|
||||
uint32_t ZCALLBACK fwrite_mem_func(voidpf opaque, voidpf stream, const void *buf, uint32_t size)
|
||||
uint32_t ZCALLBACK fwrite_mem_func(ZIP_UNUSED voidpf opaque, voidpf stream, const void *buf, uint32_t size)
|
||||
{
|
||||
ourmemory_t *mem = (ourmemory_t *)stream;
|
||||
uint32_t newmemsize = 0;
|
||||
@@ -110,13 +110,13 @@ uint32_t ZCALLBACK fwrite_mem_func(voidpf opaque, voidpf stream, const void *buf
|
||||
return size;
|
||||
}
|
||||
|
||||
long ZCALLBACK ftell_mem_func(voidpf opaque, voidpf stream)
|
||||
long ZCALLBACK ftell_mem_func(ZIP_UNUSED voidpf opaque, voidpf stream)
|
||||
{
|
||||
ourmemory_t *mem = (ourmemory_t *)stream;
|
||||
return mem->cur_offset;
|
||||
}
|
||||
|
||||
long ZCALLBACK fseek_mem_func(voidpf opaque, voidpf stream, uint32_t offset, int origin)
|
||||
long ZCALLBACK fseek_mem_func(ZIP_UNUSED voidpf opaque, voidpf stream, uint32_t offset, int origin)
|
||||
{
|
||||
ourmemory_t *mem = (ourmemory_t *)stream;
|
||||
uint32_t new_pos = 0;
|
||||
@@ -141,13 +141,13 @@ long ZCALLBACK fseek_mem_func(voidpf opaque, voidpf stream, uint32_t offset, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZCALLBACK fclose_mem_func(voidpf opaque, voidpf stream)
|
||||
int ZCALLBACK fclose_mem_func(ZIP_UNUSED voidpf opaque, ZIP_UNUSED voidpf stream)
|
||||
{
|
||||
/* Even with grow = 1, caller must always free() memory */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZCALLBACK ferror_mem_func(voidpf opaque, voidpf stream)
|
||||
int ZCALLBACK ferror_mem_func(ZIP_UNUSED voidpf opaque, ZIP_UNUSED voidpf stream)
|
||||
{
|
||||
/* We never return errors */
|
||||
return 0;
|
||||
|
||||
@@ -252,19 +252,19 @@ static int unzReadUInt64(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidp
|
||||
}
|
||||
|
||||
/* Locate the Central directory of a zip file (at the end, just before the global comment) */
|
||||
static uint64_t unzSearchCentralDir(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream)
|
||||
static int unzSearchCentralDir(const zlib_filefunc64_32_def *pzlib_filefunc_def, uint64_t *pos_found, voidpf filestream)
|
||||
{
|
||||
uint8_t buf[BUFREADCOMMENT + 4];
|
||||
uint64_t file_size = 0;
|
||||
uint64_t back_read = 4;
|
||||
uint64_t max_back = UINT16_MAX; /* maximum size of global comment */
|
||||
uint64_t pos_found = 0;
|
||||
uint32_t read_size = 0;
|
||||
uint64_t read_pos = 0;
|
||||
uint32_t i = 0;
|
||||
*pos_found = 0;
|
||||
|
||||
if (ZSEEK64(*pzlib_filefunc_def, filestream, 0, ZLIB_FILEFUNC_SEEK_END) != 0)
|
||||
return 0;
|
||||
return UNZ_ERRNO;
|
||||
|
||||
file_size = ZTELL64(*pzlib_filefunc_def, filestream);
|
||||
|
||||
@@ -293,52 +293,49 @@ static uint64_t unzSearchCentralDir(const zlib_filefunc64_32_def *pzlib_filefunc
|
||||
((*(buf+i+2)) == (ENDHEADERMAGIC >> 16 & 0xff)) &&
|
||||
((*(buf+i+3)) == (ENDHEADERMAGIC >> 24 & 0xff)))
|
||||
{
|
||||
pos_found = read_pos+i;
|
||||
break;
|
||||
*pos_found = read_pos+i;
|
||||
return UNZ_OK;
|
||||
}
|
||||
|
||||
if (pos_found != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return pos_found;
|
||||
return UNZ_ERRNO;
|
||||
}
|
||||
|
||||
/* Locate the Central directory 64 of a zipfile (at the end, just before the global comment) */
|
||||
static uint64_t unzSearchCentralDir64(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream,
|
||||
static int unzSearchCentralDir64(const zlib_filefunc64_32_def *pzlib_filefunc_def, uint64_t *offset, voidpf filestream,
|
||||
const uint64_t endcentraloffset)
|
||||
{
|
||||
uint64_t offset = 0;
|
||||
uint32_t value32 = 0;
|
||||
*offset = 0;
|
||||
|
||||
/* Zip64 end of central directory locator */
|
||||
if (ZSEEK64(*pzlib_filefunc_def, filestream, endcentraloffset - SIZECENTRALHEADERLOCATOR, ZLIB_FILEFUNC_SEEK_SET) != 0)
|
||||
return 0;
|
||||
return UNZ_ERRNO;
|
||||
|
||||
/* Read locator signature */
|
||||
if (unzReadUInt32(pzlib_filefunc_def, filestream, &value32) != UNZ_OK)
|
||||
return 0;
|
||||
return UNZ_ERRNO;
|
||||
if (value32 != ZIP64ENDLOCHEADERMAGIC)
|
||||
return 0;
|
||||
return UNZ_ERRNO;
|
||||
/* Number of the disk with the start of the zip64 end of central directory */
|
||||
if (unzReadUInt32(pzlib_filefunc_def, filestream, &value32) != UNZ_OK)
|
||||
return 0;
|
||||
return UNZ_ERRNO;
|
||||
/* Relative offset of the zip64 end of central directory record */
|
||||
if (unzReadUInt64(pzlib_filefunc_def, filestream, &offset) != UNZ_OK)
|
||||
return 0;
|
||||
if (unzReadUInt64(pzlib_filefunc_def, filestream, offset) != UNZ_OK)
|
||||
return UNZ_ERRNO;
|
||||
/* Total number of disks */
|
||||
if (unzReadUInt32(pzlib_filefunc_def, filestream, &value32) != UNZ_OK)
|
||||
return 0;
|
||||
return UNZ_ERRNO;
|
||||
/* Goto end of central directory record */
|
||||
if (ZSEEK64(*pzlib_filefunc_def, filestream, offset, ZLIB_FILEFUNC_SEEK_SET) != 0)
|
||||
return 0;
|
||||
if (ZSEEK64(*pzlib_filefunc_def, filestream, *offset, ZLIB_FILEFUNC_SEEK_SET) != 0)
|
||||
return UNZ_ERRNO;
|
||||
/* The signature */
|
||||
if (unzReadUInt32(pzlib_filefunc_def, filestream, &value32) != UNZ_OK)
|
||||
return 0;
|
||||
return UNZ_ERRNO;
|
||||
if (value32 != ZIP64ENDHEADERMAGIC)
|
||||
return 0;
|
||||
return UNZ_ERRNO;
|
||||
|
||||
return offset;
|
||||
return UNZ_OK;
|
||||
}
|
||||
|
||||
static unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def)
|
||||
@@ -373,8 +370,8 @@ static unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_f
|
||||
us.is_zip64 = 0;
|
||||
|
||||
/* Search for end of central directory header */
|
||||
central_pos = unzSearchCentralDir(&us.z_filefunc, us.filestream);
|
||||
if (central_pos)
|
||||
err = unzSearchCentralDir(&us.z_filefunc, ¢ral_pos, us.filestream);
|
||||
if (err == UNZ_OK)
|
||||
{
|
||||
if (ZSEEK64(us.z_filefunc, us.filestream, central_pos, ZLIB_FILEFUNC_SEEK_SET) != 0)
|
||||
err = UNZ_ERRNO;
|
||||
@@ -415,8 +412,8 @@ static unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_f
|
||||
if (err == UNZ_OK)
|
||||
{
|
||||
/* Search for Zip64 end of central directory header */
|
||||
central_pos64 = unzSearchCentralDir64(&us.z_filefunc, us.filestream, central_pos);
|
||||
if (central_pos64)
|
||||
int err64 = unzSearchCentralDir64(&us.z_filefunc, ¢ral_pos64, us.filestream, central_pos);
|
||||
if (err64 == UNZ_OK)
|
||||
{
|
||||
central_pos = central_pos64;
|
||||
us.is_zip64 = 1;
|
||||
@@ -1300,16 +1297,11 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, uint32_t len)
|
||||
s->pfile_in_zip_read->stream.next_out = (uint8_t*)buf;
|
||||
s->pfile_in_zip_read->stream.avail_out = (uint16_t)len;
|
||||
|
||||
if (s->pfile_in_zip_read->raw)
|
||||
if ((s->pfile_in_zip_read->compression_method == 0) || (s->pfile_in_zip_read->raw))
|
||||
{
|
||||
if (len > s->pfile_in_zip_read->rest_read_compressed + s->pfile_in_zip_read->stream.avail_in)
|
||||
s->pfile_in_zip_read->stream.avail_out = (uint16_t)s->pfile_in_zip_read->rest_read_compressed +
|
||||
s->pfile_in_zip_read->stream.avail_in;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (len > s->pfile_in_zip_read->rest_read_uncompressed)
|
||||
s->pfile_in_zip_read->stream.avail_out = (uint16_t)s->pfile_in_zip_read->rest_read_uncompressed;
|
||||
s->pfile_in_zip_read->stream.avail_in;
|
||||
}
|
||||
|
||||
do
|
||||
@@ -1668,6 +1660,9 @@ extern int ZEXPORT unzGoToFirstFile2(unzFile file, unz_file_info64 *pfile_info,
|
||||
return UNZ_PARAMERROR;
|
||||
s = (unz64_internal*)file;
|
||||
|
||||
if (s->gi.number_entry == 0)
|
||||
return UNZ_END_OF_LIST_OF_FILE;
|
||||
|
||||
s->pos_in_central_dir = s->offset_central_dir;
|
||||
s->num_file = 0;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,12 +53,6 @@ typedef voidp zipFile;
|
||||
#define ZIP_BADZIPFILE (-103)
|
||||
#define ZIP_INTERNALERROR (-104)
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define ZIP_UNUSED __attribute__((__unused__))
|
||||
#else
|
||||
# define ZIP_UNUSED
|
||||
#endif
|
||||
|
||||
#ifndef DEF_MEM_LEVEL
|
||||
# if MAX_MEM_LEVEL >= 8
|
||||
# define DEF_MEM_LEVEL 8
|
||||
@@ -172,6 +166,26 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char *filename, c
|
||||
int strategy, const char *password, ZIP_UNUSED uint32_t crc_for_crypting, uint16_t version_madeby, uint16_t flag_base, int zip64);
|
||||
/* Same as zipOpenNewFileInZip4 with zip64 support */
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip5(zipFile file,
|
||||
const char *filename,
|
||||
const zip_fileinfo *zipfi,
|
||||
const void *extrafield_local,
|
||||
uint16_t size_extrafield_local,
|
||||
const void *extrafield_global,
|
||||
uint16_t size_extrafield_global,
|
||||
const char *comment,
|
||||
uint16_t flag_base,
|
||||
int zip64,
|
||||
uint16_t method,
|
||||
int level,
|
||||
int raw,
|
||||
int windowBits,
|
||||
int memLevel,
|
||||
int strategy,
|
||||
const char *password,
|
||||
int aes);
|
||||
/* Allowing optional aes */
|
||||
|
||||
extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void *buf, uint32_t len);
|
||||
/* Write data in the zipfile */
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
PODS:
|
||||
- SSZipArchive (2.0.8)
|
||||
- SSZipArchive (2.1.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- SSZipArchive (from `..`)
|
||||
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
|
||||
:path: ..
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
SSZipArchive: e6ab66e1936fac7e3b5073e9f5eb364d91dfbfc7
|
||||
SSZipArchive: 1e8e53dcb11bca3ded4738958dc49fc467320a14
|
||||
|
||||
PODFILE CHECKSUM: 0dc500eb72745751ccba7677de4da5534fcef36d
|
||||
|
||||
|
||||
@@ -412,7 +412,7 @@
|
||||
INFOPLIST_FILE = SwiftExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
OTHER_SWIFT_FLAGS = "-DUseCarthage";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
@@ -429,7 +429,7 @@
|
||||
INFOPLIST_FILE = SwiftExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
OTHER_SWIFT_FLAGS = "-DUseCarthage";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
@@ -545,7 +545,7 @@
|
||||
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_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
@@ -558,7 +558,7 @@
|
||||
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_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
};
|
||||
@@ -570,7 +570,7 @@
|
||||
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_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExampleTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample";
|
||||
@@ -583,7 +583,7 @@
|
||||
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_BUNDLE_IDENTIFIER = com.ziparchive.SwiftExampleTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample";
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="retina5_5" orientation="portrait">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="retina3_5" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
@@ -19,50 +19,50 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="password" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Tal-c0-sro">
|
||||
<rect key="frame" x="166" y="13" width="83" height="30"/>
|
||||
<rect key="frame" x="118.5" y="46" width="83" height="30"/>
|
||||
<nil key="textColor"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Uwd-kM-cdh">
|
||||
<rect key="frame" x="150.66666666666669" y="51" width="113.00000000000006" height="30"/>
|
||||
<rect key="frame" x="103.5" y="84" width="113" height="30"/>
|
||||
<state key="normal" title="Zip Sample Data"/>
|
||||
<connections>
|
||||
<action selector="zipPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="dQS-RP-2Yl"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XUJ-IR-RIS">
|
||||
<rect key="frame" x="141.66666666666669" y="89" width="131.00000000000006" height="30"/>
|
||||
<rect key="frame" x="94.5" y="122" width="131" height="30"/>
|
||||
<state key="normal" title="Unzip Sample Data"/>
|
||||
<connections>
|
||||
<action selector="unzipPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="gGR-nU-aS3"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lbq-oS-Rlj">
|
||||
<rect key="frame" x="187.66666666666666" y="212.66666666666666" width="39" height="30"/>
|
||||
<rect key="frame" x="140.5" y="245" width="39" height="30"/>
|
||||
<state key="normal" title="Reset"/>
|
||||
<connections>
|
||||
<action selector="resetPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="n8G-qy-egF"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="09F-6Q-slx" userLabel="File1">
|
||||
<rect key="frame" x="67" y="126.99999999999999" width="294" height="20.666666666666643"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File1" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="09F-6Q-slx" userLabel="File1">
|
||||
<rect key="frame" x="16" y="160" width="288" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PSK-Jd-Mwc" userLabel="File2">
|
||||
<rect key="frame" x="67" y="155.66666666666663" width="294" height="20.333333333333343"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File2" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PSK-Jd-Mwc" userLabel="File2">
|
||||
<rect key="frame" x="16" y="188" width="288" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pW5-rw-iqM" userLabel="File3">
|
||||
<rect key="frame" x="67" y="184" width="294" height="20.666666666666657"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="File3" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pW5-rw-iqM" userLabel="File3">
|
||||
<rect key="frame" x="16" y="217" width="288" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -70,21 +70,21 @@
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="09F-6Q-slx" secondAttribute="trailing" constant="33" id="3S4-8t-aQA"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="09F-6Q-slx" secondAttribute="trailing" id="3S4-8t-aQA"/>
|
||||
<constraint firstItem="XUJ-IR-RIS" firstAttribute="centerX" secondItem="Lbq-oS-Rlj" secondAttribute="centerX" id="AYF-iB-SJU"/>
|
||||
<constraint firstItem="Uwd-kM-cdh" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="CTF-Hv-dt4"/>
|
||||
<constraint firstItem="Tal-c0-sro" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="Czk-W6-E7s"/>
|
||||
<constraint firstItem="XUJ-IR-RIS" firstAttribute="top" secondItem="Uwd-kM-cdh" secondAttribute="bottom" constant="8" symbolic="YES" id="OIr-Yf-tdY"/>
|
||||
<constraint firstItem="09F-6Q-slx" firstAttribute="trailing" secondItem="PSK-Jd-Mwc" secondAttribute="trailing" id="TGC-ob-dm0"/>
|
||||
<constraint firstItem="Uwd-kM-cdh" firstAttribute="top" secondItem="Tal-c0-sro" secondAttribute="bottom" constant="8" symbolic="YES" id="Udb-33-mrs"/>
|
||||
<constraint firstItem="Uwd-kM-cdh" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="31" id="Uh0-R8-WFe"/>
|
||||
<constraint firstItem="pW5-rw-iqM" firstAttribute="top" secondItem="PSK-Jd-Mwc" secondAttribute="bottom" constant="8" symbolic="YES" id="VfM-Vg-Yai"/>
|
||||
<constraint firstItem="09F-6Q-slx" firstAttribute="top" secondItem="XUJ-IR-RIS" secondAttribute="bottom" constant="8" symbolic="YES" id="Wpv-VU-gb1"/>
|
||||
<constraint firstItem="Uwd-kM-cdh" firstAttribute="centerX" secondItem="XUJ-IR-RIS" secondAttribute="centerX" id="dW9-nF-tLe"/>
|
||||
<constraint firstItem="PSK-Jd-Mwc" firstAttribute="leading" secondItem="pW5-rw-iqM" secondAttribute="leading" id="eJr-2x-5k4"/>
|
||||
<constraint firstItem="Tal-c0-sro" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="26" id="nXL-ng-YDN"/>
|
||||
<constraint firstItem="09F-6Q-slx" firstAttribute="leading" secondItem="PSK-Jd-Mwc" secondAttribute="leading" id="ndV-Ni-q25"/>
|
||||
<constraint firstItem="Lbq-oS-Rlj" firstAttribute="top" secondItem="pW5-rw-iqM" secondAttribute="bottom" constant="8" symbolic="YES" id="qRj-kV-fEA"/>
|
||||
<constraint firstItem="09F-6Q-slx" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="47" id="rLi-aF-EpY"/>
|
||||
<constraint firstItem="09F-6Q-slx" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="rLi-aF-EpY"/>
|
||||
<constraint firstItem="PSK-Jd-Mwc" firstAttribute="top" secondItem="09F-6Q-slx" secondAttribute="bottom" constant="8" symbolic="YES" id="waq-c1-rAn"/>
|
||||
<constraint firstItem="PSK-Jd-Mwc" firstAttribute="trailing" secondItem="pW5-rw-iqM" secondAttribute="trailing" id="wix-Cp-XH9"/>
|
||||
</constraints>
|
||||
|
||||
@@ -36,11 +36,6 @@ class ViewController: UIViewController {
|
||||
file3.text = ""
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
// MARK: IBAction
|
||||
|
||||
@IBAction func zipPressed(_: UIButton) {
|
||||
@@ -48,12 +43,19 @@ class ViewController: UIViewController {
|
||||
zipPath = tempZipPath()
|
||||
let password = passwordField.text
|
||||
|
||||
let success = SSZipArchive.createZipFile(atPath: zipPath!, withContentsOfDirectory: sampleDataPath, withPassword: password?.isEmpty == false ? password : nil)
|
||||
let success = SSZipArchive.createZipFile(atPath: zipPath!,
|
||||
withContentsOfDirectory: sampleDataPath,
|
||||
keepParentDirectory: false,
|
||||
compressionLevel: -1,
|
||||
password: password?.isEmpty == false ? password : nil,
|
||||
aes: true,
|
||||
progressHandler: nil)
|
||||
if success {
|
||||
print("Success zip")
|
||||
unzipButton.isEnabled = true
|
||||
zipButton.isEnabled = false
|
||||
} else {
|
||||
print("No success")
|
||||
print("No success zip")
|
||||
}
|
||||
resetButton.isEnabled = true
|
||||
}
|
||||
@@ -68,12 +70,20 @@ class ViewController: UIViewController {
|
||||
}
|
||||
|
||||
let password = passwordField.text
|
||||
let success: Void? = try? SSZipArchive.unzipFile(atPath: zipPath,
|
||||
toDestination: unzipPath,
|
||||
overwrite: true,
|
||||
password: password?.isEmpty == false ? password : nil)
|
||||
if success == nil {
|
||||
print("No success")
|
||||
let success: Bool = SSZipArchive.unzipFile(atPath: zipPath,
|
||||
toDestination: unzipPath,
|
||||
preserveAttributes: true,
|
||||
overwrite: true,
|
||||
nestedZipLevel: 1,
|
||||
password: password?.isEmpty == false ? password : nil,
|
||||
error: nil,
|
||||
delegate: nil,
|
||||
progressHandler: nil,
|
||||
completionHandler: nil)
|
||||
if success != false {
|
||||
print("Success unzip")
|
||||
} else {
|
||||
print("No success unzip")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -127,7 +137,6 @@ class ViewController: UIViewController {
|
||||
} catch {
|
||||
return nil
|
||||
}
|
||||
|
||||
return url.path
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,6 @@
|
||||
37952C551F63B7A000DD6677 /* pwd2key.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913F81F0009310094DB3B /* pwd2key.h */; };
|
||||
37952C561F63B7A000DD6677 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913F91F0009310094DB3B /* sha1.c */; };
|
||||
37952C571F63B7A000DD6677 /* sha1.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913FA1F0009310094DB3B /* sha1.h */; };
|
||||
37952C581F63B8C400DD6677 /* SSZipArchive+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87ACF3E91D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift */; };
|
||||
37952C661F63BBBB00DD6677 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913FC1F0009320094DB3B /* crypt.c */; };
|
||||
37952C671F63BBBB00DD6677 /* ioapi_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = 373913E41F0009310094DB3B /* ioapi_buf.c */; };
|
||||
37952C681F63BBBB00DD6677 /* ioapi_buf.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913E51F0009310094DB3B /* ioapi_buf.h */; };
|
||||
@@ -138,12 +137,10 @@
|
||||
37952C871F63BBC000DD6677 /* sha1.h in Headers */ = {isa = PBXBuildFile; fileRef = 373913FA1F0009310094DB3B /* sha1.h */; };
|
||||
37952C881F63BBD500DD6677 /* SSZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE481C0DF7950004A2F1 /* SSZipArchive.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
37952C891F63BBDA00DD6677 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = B423AE491C0DF7950004A2F1 /* SSZipArchive.m */; };
|
||||
37952C8A1F63BBE100DD6677 /* SSZipArchive+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87ACF3E91D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift */; };
|
||||
37952C8B1F63BBE400DD6677 /* ZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE4A1C0DF7950004A2F1 /* ZipArchive.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
37952C8C1F63BBED00DD6677 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B423AE6E1C0DF83F0004A2F1 /* libz.tbd */; };
|
||||
37952C8D1F63BBF300DD6677 /* SSZipCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 389869341D5BC30100F18782 /* SSZipCommon.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
389869351D5BC30100F18782 /* SSZipCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 389869341D5BC30100F18782 /* SSZipCommon.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
87ACF3EA1D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87ACF3E91D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift */; };
|
||||
AFF75A2D1C3727F000F450AC /* ZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE4A1C0DF7950004A2F1 /* ZipArchive.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
AFF75A2E1C37280200F450AC /* SSZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = B423AE481C0DF7950004A2F1 /* SSZipArchive.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
AFF75A2F1C37280200F450AC /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = B423AE491C0DF7950004A2F1 /* SSZipArchive.m */; };
|
||||
@@ -199,7 +196,6 @@
|
||||
37952C261F63B50D00DD6677 /* ZipArchive.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
37952C5E1F63BB7100DD6677 /* ZipArchive.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
389869341D5BC30100F18782 /* SSZipCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSZipCommon.h; sourceTree = "<group>"; };
|
||||
87ACF3E91D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SSZipArchive+Swift.swift"; sourceTree = "<group>"; };
|
||||
AFF75A241C37279600F450AC /* ZipArchive.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B423AE1A1C0DF76A0004A2F1 /* ZipArchive.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B423AE3D1C0DF7950004A2F1 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
@@ -307,7 +303,6 @@
|
||||
B423AE3E1C0DF7950004A2F1 /* minizip */,
|
||||
B423AE481C0DF7950004A2F1 /* SSZipArchive.h */,
|
||||
B423AE491C0DF7950004A2F1 /* SSZipArchive.m */,
|
||||
87ACF3E91D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift */,
|
||||
B423AE4A1C0DF7950004A2F1 /* ZipArchive.h */,
|
||||
);
|
||||
path = SSZipArchive;
|
||||
@@ -608,7 +603,6 @@
|
||||
files = (
|
||||
37952C541F63B7A000DD6677 /* pwd2key.c in Sources */,
|
||||
37952C521F63B7A000DD6677 /* prng.c in Sources */,
|
||||
37952C581F63B8C400DD6677 /* SSZipArchive+Swift.swift in Sources */,
|
||||
37952C401F63B78A00DD6677 /* ioapi_mem.c in Sources */,
|
||||
37952C561F63B7A000DD6677 /* sha1.c in Sources */,
|
||||
37952C4A1F63B7A000DD6677 /* aestab.c in Sources */,
|
||||
@@ -633,7 +627,6 @@
|
||||
files = (
|
||||
37952C801F63BBC000DD6677 /* hmac.c in Sources */,
|
||||
37952C841F63BBC000DD6677 /* pwd2key.c in Sources */,
|
||||
37952C8A1F63BBE100DD6677 /* SSZipArchive+Swift.swift in Sources */,
|
||||
37952C7E1F63BBC000DD6677 /* fileenc.c in Sources */,
|
||||
37952C891F63BBDA00DD6677 /* SSZipArchive.m in Sources */,
|
||||
37952C7A1F63BBC000DD6677 /* aestab.c in Sources */,
|
||||
@@ -682,7 +675,6 @@
|
||||
files = (
|
||||
3739141D1F0009FF0094DB3B /* hmac.c in Sources */,
|
||||
3739140E1F0009E50094DB3B /* aes_ni.c in Sources */,
|
||||
87ACF3EA1D2DAFAD00ED2F7E /* SSZipArchive+Swift.swift in Sources */,
|
||||
373914211F0009FF0094DB3B /* pwd2key.c in Sources */,
|
||||
373914171F0009FF0094DB3B /* aestab.c in Sources */,
|
||||
373914021F0009C80094DB3B /* minishared.c in Sources */,
|
||||
@@ -719,7 +711,7 @@
|
||||
INFOPLIST_FILE = SSZipArchive/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
|
||||
PRODUCT_NAME = "$(PROJECT_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
@@ -745,7 +737,7 @@
|
||||
INFOPLIST_FILE = SSZipArchive/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
|
||||
PRODUCT_NAME = "$(PROJECT_NAME)";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
@@ -771,7 +763,7 @@
|
||||
INFOPLIST_FILE = SSZipArchive/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
|
||||
PRODUCT_NAME = "$(PROJECT_NAME)";
|
||||
SDKROOT = watchos;
|
||||
SKIP_INSTALL = YES;
|
||||
@@ -800,7 +792,7 @@
|
||||
INFOPLIST_FILE = SSZipArchive/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
|
||||
PRODUCT_NAME = "$(PROJECT_NAME)";
|
||||
SDKROOT = watchos;
|
||||
SKIP_INSTALL = YES;
|
||||
@@ -824,7 +816,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
|
||||
PRODUCT_NAME = "$(PROJECT_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
@@ -846,7 +838,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
|
||||
PRODUCT_NAME = "$(PROJECT_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
@@ -975,7 +967,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
|
||||
PRODUCT_NAME = "$(PROJECT_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@@ -1000,7 +992,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ZipArchive;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ziparchive.ZipArchive;
|
||||
PRODUCT_NAME = "$(PROJECT_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
@@ -1026,6 +1018,7 @@
|
||||
37952C641F63BB7100DD6677 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
AFF75A291C37279600F450AC /* Build configuration list for PBXNativeTarget "ZipArchive-Mac" */ = {
|
||||
isa = XCConfigurationList;
|
||||
|
||||
Reference in New Issue
Block a user