Compare commits
179 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bb8a98d51 | ||
|
|
662da2d427 | ||
|
|
3a222d9155 | ||
|
|
ab7eb21412 | ||
|
|
40229f248b | ||
|
|
a7b0ae8f35 | ||
|
|
9ab5928c55 | ||
|
|
5bdd904a38 | ||
|
|
489bd49cb4 | ||
|
|
67cef95bb6 | ||
|
|
5a422fc833 | ||
|
|
aa307f46db | ||
|
|
1f7d7372de | ||
|
|
55f4fa6fc6 | ||
|
|
b7f0452bf8 | ||
|
|
eb36213ef9 | ||
|
|
c7ed207ca6 | ||
|
|
cd458550d4 | ||
|
|
fc022ba86c | ||
|
|
90efaf41c7 | ||
|
|
b3d132ba39 | ||
|
|
ff2e990759 | ||
|
|
71daeedd09 | ||
|
|
163a811ddb | ||
|
|
b7898d7fb4 | ||
|
|
ef6b668312 | ||
|
|
af51c6ad53 | ||
|
|
1ebe3fa03c | ||
|
|
08d4a2a721 | ||
|
|
3797913580 | ||
|
|
7768bec22e | ||
|
|
3a07e9888d | ||
|
|
f4119f3723 | ||
|
|
6a6f6fe832 | ||
|
|
1a14dbb6d6 | ||
|
|
0b01b24824 | ||
|
|
ded74bc073 | ||
|
|
28be5a67ab | ||
|
|
7ccc986657 | ||
|
|
cfee6b5b89 | ||
|
|
676da25532 | ||
|
|
8d2b39b5ec | ||
|
|
af85bf97a9 | ||
|
|
b07d0c5d51 | ||
|
|
aab8d383b3 | ||
|
|
4c97093700 | ||
|
|
a1cc7c1654 | ||
|
|
7a6c677c17 | ||
|
|
d607ba044b | ||
|
|
c39636b71b | ||
|
|
705a69840f | ||
|
|
a9ece3bef7 | ||
|
|
fc61e0358d | ||
|
|
9761f045b2 | ||
|
|
2a1eee19b4 | ||
|
|
35b181504c | ||
|
|
8be53bee68 | ||
|
|
cc714460f9 | ||
|
|
88c2ab7516 | ||
|
|
c9d93d23e3 | ||
|
|
bddefcebfe | ||
|
|
95d3d3544a | ||
|
|
4e3625684d | ||
|
|
cc24921107 | ||
|
|
487093160b | ||
|
|
dbc332ce70 | ||
|
|
cedaa5250c | ||
|
|
938749897d | ||
|
|
c881c8528f | ||
|
|
13e3ab93b4 | ||
|
|
5492b7bcea | ||
|
|
8b046fc30b | ||
|
|
ef396cbd52 | ||
|
|
4b4cce2666 | ||
|
|
d8a7fd0e8c | ||
|
|
0b476953df | ||
|
|
056fe04808 | ||
|
|
292d95e41a | ||
|
|
fede9541b4 | ||
|
|
ae50a6d40a | ||
|
|
a75d901a85 | ||
|
|
cb037e1010 | ||
|
|
c119896966 | ||
|
|
bf55cb47b7 | ||
|
|
801d1198b5 | ||
|
|
94a6637002 | ||
|
|
b37ab60ba0 | ||
|
|
a90b2a9611 | ||
|
|
7e44caef39 | ||
|
|
0c9aaee02b | ||
|
|
bd02992224 | ||
|
|
9426653711 | ||
|
|
33c7884202 | ||
|
|
67403e8a28 | ||
|
|
74ce9fc2c7 | ||
|
|
553c4be486 | ||
|
|
9f93d0c1b7 | ||
|
|
55437a8b8e | ||
|
|
d68c99b890 | ||
|
|
e1bfb6e8ed | ||
|
|
874ebd8651 | ||
|
|
a8f065f2a1 | ||
|
|
b89dfcf4fd | ||
|
|
b688b9859a | ||
|
|
54875c8192 | ||
|
|
df0d5536e8 | ||
|
|
60f577ab9a | ||
|
|
60312c173b | ||
|
|
c363747a15 | ||
|
|
e29efca7bf | ||
|
|
024241a3e0 | ||
|
|
47c50d0482 | ||
|
|
2385ac9241 | ||
|
|
b91fe135e2 | ||
|
|
57b6018ca0 | ||
|
|
89b32b9328 | ||
|
|
1b2ec1a9ec | ||
|
|
b4c9bde3fb | ||
|
|
4fca963b62 | ||
|
|
281571d99f | ||
|
|
47afe71fa2 | ||
|
|
de0ffe7478 | ||
|
|
e422866c97 | ||
|
|
653caaa9b2 | ||
|
|
d3c40f0e95 | ||
|
|
ebc0b248ef | ||
|
|
f89c159b2a | ||
|
|
a5de5b6bef | ||
|
|
bf95dc2fd4 | ||
|
|
c2b33b42d0 | ||
|
|
b91252282e | ||
|
|
1fefbc022f | ||
|
|
273fc1b36e | ||
|
|
164ae9bfd3 | ||
|
|
6ca6e0c28f | ||
|
|
07cfb62107 | ||
|
|
364be2ed4f | ||
|
|
524ca1abae | ||
|
|
d30b543f34 | ||
|
|
ce6cbe1193 | ||
|
|
4cd142a39c | ||
|
|
c81002605b | ||
|
|
5227bb251b | ||
|
|
3bb7fe8d26 | ||
|
|
21c3694d0c | ||
|
|
84c8171151 | ||
|
|
f9136dd744 | ||
|
|
d7ac059a8a | ||
|
|
adfc3cae92 | ||
|
|
9d322d173f | ||
|
|
c91865d01b | ||
|
|
548b3acbba | ||
|
|
45b93c037d | ||
|
|
7627a1b4fc | ||
|
|
481ddf2096 | ||
|
|
b078433f2e | ||
|
|
ceae6ae819 | ||
|
|
d7c7955cdc | ||
|
|
ffbacdb288 | ||
|
|
4ac78e3121 | ||
|
|
362b011990 | ||
|
|
92f1142056 | ||
|
|
b4fa2e4739 | ||
|
|
7aea62f0dd | ||
|
|
798a317bdc | ||
|
|
ec5de8e02b | ||
|
|
a15c76e057 | ||
|
|
f7266f6b4d | ||
|
|
d6f5b1c7a3 | ||
|
|
2f05d42988 | ||
|
|
d630ae5f5e | ||
|
|
04605b7967 | ||
|
|
294cd2992b | ||
|
|
a311e60107 | ||
|
|
69fb8f4a4c | ||
|
|
1d163e4db5 | ||
|
|
a53f908392 | ||
|
|
3e2424437f | ||
|
|
713835cc28 |
32
.gitignore
vendored
32
.gitignore
vendored
@@ -1,6 +1,32 @@
|
||||
.DS_Store
|
||||
*.mode1v3
|
||||
# Xcode
|
||||
#
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
*.xcworkspace
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
.DS_Store
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
|
||||
Pods/
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
Carthage/Checkouts
|
||||
Carthage/Build
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
# SSZipArchive Changelog
|
||||
|
||||
### Version 0.2.1
|
||||
|
||||
[Released May 9, 2012](https://github.com/samsoffes/sskeychain/tree/0.2.1)
|
||||
|
||||
* Support for symbolic links — [@jparishy](http://github.com/jparishy)
|
||||
* Fix several warnings
|
||||
|
||||
### Version 0.2.0
|
||||
|
||||
[Released May 7, 2012](https://github.com/samsoffes/sskeychain/tree/0.2.0)
|
||||
|
||||
* Add unzipping delegate — [@uppfinnarn](http://github.com/uppfinnarn)
|
||||
* Fix unzipping with passwords
|
||||
* Fix modified at dates — [@brantsears](http://github.com/brantsears)
|
||||
* Fix truncated files. Ignore the zip headers and unzip until there is no more file. — [@jparishy](http://github.com/jparishy)
|
||||
|
||||
### Version 0.1.2
|
||||
|
||||
[Released December 26, 2011](https://github.com/samsoffes/sskeychain/tree/0.1.2)
|
||||
|
||||
* Add creation support. Thanks Johnnie Walker ([@randomsequence](https://github.com/randomsequence))!
|
||||
|
||||
### Version 0.1.1
|
||||
|
||||
[Released October 31, 2011](https://github.com/samsoffes/sskeychain/tree/0.1.1)
|
||||
|
||||
* Added basic tests
|
||||
* Upgraded minizip to 1.1 to support zip64
|
||||
|
||||
### Version 0.1.0
|
||||
|
||||
[Released September 18, 2011](https://github.com/samsoffes/sskeychain/tree/0.1.0)
|
||||
|
||||
* Initial release
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2010-2012 Sam Soffes
|
||||
Copyright (c) 2010-2015, Sam Soffes, http://soff.es
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
581
ObjectiveCExample/ObjectiveCExample.xcodeproj/project.pbxproj
Normal file
581
ObjectiveCExample/ObjectiveCExample.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,581 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
8DFE19EF1BDA9FF300709011 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19EE1BDA9FF300709011 /* main.m */; };
|
||||
8DFE19F21BDA9FF300709011 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19F11BDA9FF300709011 /* AppDelegate.m */; };
|
||||
8DFE19F51BDA9FF300709011 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19F41BDA9FF300709011 /* ViewController.m */; };
|
||||
8DFE19F81BDA9FF300709011 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19F61BDA9FF300709011 /* Main.storyboard */; };
|
||||
8DFE19FA1BDA9FF300709011 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19F91BDA9FF300709011 /* Assets.xcassets */; };
|
||||
8DFE19FD1BDA9FF300709011 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19FB1BDA9FF300709011 /* LaunchScreen.storyboard */; };
|
||||
8DFE1A081BDA9FF300709011 /* SSZipArchiveTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */; };
|
||||
8DFE1A141BDAA0A800709011 /* CollectingDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */; };
|
||||
8DFE1A271BDAA10100709011 /* hello.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A161BDAA10100709011 /* hello.zip */; };
|
||||
8DFE1A281BDAA10100709011 /* IncorrectHeaders.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A171BDAA10100709011 /* IncorrectHeaders.zip */; };
|
||||
8DFE1A291BDAA10100709011 /* PermissionsTestApp.app in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A181BDAA10100709011 /* PermissionsTestApp.app */; };
|
||||
8DFE1A2A1BDAA10100709011 /* RelativeSymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A191BDAA10100709011 /* RelativeSymbolicLink.zip */; };
|
||||
8DFE1A2B1BDAA10100709011 /* SymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1A1BDAA10100709011 /* SymbolicLink.zip */; };
|
||||
8DFE1A2C1BDAA10100709011 /* TestArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1B1BDAA10100709011 /* TestArchive.zip */; };
|
||||
8DFE1A2D1BDAA10100709011 /* TestPasswordArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1C1BDAA10100709011 /* TestPasswordArchive.zip */; };
|
||||
8DFE1A2E1BDAA10100709011 /* Unicode.zip in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1D1BDAA10100709011 /* Unicode.zip */; };
|
||||
8DFE1A2F1BDAA10100709011 /* 0.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A1F1BDAA10100709011 /* 0.m4a */; };
|
||||
8DFE1A301BDAA10100709011 /* 1.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A201BDAA10100709011 /* 1.m4a */; };
|
||||
8DFE1A311BDAA10100709011 /* 2.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A211BDAA10100709011 /* 2.m4a */; };
|
||||
8DFE1A321BDAA10100709011 /* 3.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A221BDAA10100709011 /* 3.m4a */; };
|
||||
8DFE1A331BDAA10100709011 /* 4.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A231BDAA10100709011 /* 4.m4a */; };
|
||||
8DFE1A341BDAA10100709011 /* 5.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A241BDAA10100709011 /* 5.m4a */; };
|
||||
8DFE1A351BDAA10100709011 /* 6.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A251BDAA10100709011 /* 6.m4a */; };
|
||||
8DFE1A361BDAA10100709011 /* 7.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE1A261BDAA10100709011 /* 7.m4a */; };
|
||||
BC14D61B16F6F9821E1D2AF8 /* Pods_ObjectiveCExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55A83C5BCB33C184EAB6A4E4 /* Pods_ObjectiveCExample.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
8DFE1A041BDA9FF300709011 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 8DFE19E21BDA9FF300709011 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 8DFE19E91BDA9FF300709011;
|
||||
remoteInfo = ObjectiveCExample;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1D19A4CE2C2507826BBF65B2 /* Pods-ObjectiveCExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectiveCExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
55A83C5BCB33C184EAB6A4E4 /* Pods_ObjectiveCExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ObjectiveCExample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8DFE19EA1BDA9FF300709011 /* ObjectiveCExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ObjectiveCExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8DFE19EE1BDA9FF300709011 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
8DFE19F01BDA9FF300709011 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
8DFE19F11BDA9FF300709011 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
8DFE19F31BDA9FF300709011 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
|
||||
8DFE19F41BDA9FF300709011 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
|
||||
8DFE19F71BDA9FF300709011 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
8DFE19F91BDA9FF300709011 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
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.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObjectiveCExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSZipArchiveTests.m; sourceTree = "<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>"; };
|
||||
8DFE1A161BDAA10100709011 /* hello.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = hello.zip; sourceTree = "<group>"; };
|
||||
8DFE1A171BDAA10100709011 /* IncorrectHeaders.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = IncorrectHeaders.zip; sourceTree = "<group>"; };
|
||||
8DFE1A181BDAA10100709011 /* PermissionsTestApp.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = PermissionsTestApp.app; sourceTree = "<group>"; };
|
||||
8DFE1A191BDAA10100709011 /* RelativeSymbolicLink.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = RelativeSymbolicLink.zip; sourceTree = "<group>"; };
|
||||
8DFE1A1A1BDAA10100709011 /* SymbolicLink.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SymbolicLink.zip; sourceTree = "<group>"; };
|
||||
8DFE1A1B1BDAA10100709011 /* TestArchive.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = TestArchive.zip; sourceTree = "<group>"; };
|
||||
8DFE1A1C1BDAA10100709011 /* TestPasswordArchive.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = TestPasswordArchive.zip; sourceTree = "<group>"; };
|
||||
8DFE1A1D1BDAA10100709011 /* Unicode.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Unicode.zip; sourceTree = "<group>"; };
|
||||
8DFE1A1F1BDAA10100709011 /* 0.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 0.m4a; sourceTree = "<group>"; };
|
||||
8DFE1A201BDAA10100709011 /* 1.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 1.m4a; sourceTree = "<group>"; };
|
||||
8DFE1A211BDAA10100709011 /* 2.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 2.m4a; sourceTree = "<group>"; };
|
||||
8DFE1A221BDAA10100709011 /* 3.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 3.m4a; sourceTree = "<group>"; };
|
||||
8DFE1A231BDAA10100709011 /* 4.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 4.m4a; sourceTree = "<group>"; };
|
||||
8DFE1A241BDAA10100709011 /* 5.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 5.m4a; sourceTree = "<group>"; };
|
||||
8DFE1A251BDAA10100709011 /* 6.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 6.m4a; sourceTree = "<group>"; };
|
||||
8DFE1A261BDAA10100709011 /* 7.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = 7.m4a; sourceTree = "<group>"; };
|
||||
D8928CF7ED12679FE72CDF96 /* Pods-ObjectiveCExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjectiveCExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample.release.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
8DFE19E71BDA9FF300709011 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BC14D61B16F6F9821E1D2AF8 /* Pods_ObjectiveCExample.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8DFE1A001BDA9FF300709011 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
8DFE19E11BDA9FF300709011 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE19EC1BDA9FF300709011 /* ObjectiveCExample */,
|
||||
8DFE1A061BDA9FF300709011 /* ObjectiveCExampleTests */,
|
||||
8DFE19EB1BDA9FF300709011 /* Products */,
|
||||
BCB342A5EC26DB692D25F7D4 /* Pods */,
|
||||
9DAA2CA8E954AC9481CC795C /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE19EB1BDA9FF300709011 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE19EA1BDA9FF300709011 /* ObjectiveCExample.app */,
|
||||
8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE19EC1BDA9FF300709011 /* ObjectiveCExample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE19F01BDA9FF300709011 /* AppDelegate.h */,
|
||||
8DFE19F11BDA9FF300709011 /* AppDelegate.m */,
|
||||
8DFE19F31BDA9FF300709011 /* ViewController.h */,
|
||||
8DFE19F41BDA9FF300709011 /* ViewController.m */,
|
||||
8DFE19F61BDA9FF300709011 /* Main.storyboard */,
|
||||
8DFE19F91BDA9FF300709011 /* Assets.xcassets */,
|
||||
8DFE19FB1BDA9FF300709011 /* LaunchScreen.storyboard */,
|
||||
8DFE19FE1BDA9FF300709011 /* Info.plist */,
|
||||
8DFE19ED1BDA9FF300709011 /* Supporting Files */,
|
||||
);
|
||||
path = ObjectiveCExample;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE19ED1BDA9FF300709011 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE19EE1BDA9FF300709011 /* main.m */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE1A061BDA9FF300709011 /* ObjectiveCExampleTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE1A151BDAA10100709011 /* Fixtures */,
|
||||
8DFE1A1E1BDAA10100709011 /* Multi_Zip_Test */,
|
||||
8DFE1A121BDAA0A800709011 /* CollectingDelegate.h */,
|
||||
8DFE1A131BDAA0A800709011 /* CollectingDelegate.m */,
|
||||
8DFE1A071BDA9FF300709011 /* SSZipArchiveTests.m */,
|
||||
8DFE1A091BDA9FF300709011 /* Info.plist */,
|
||||
);
|
||||
path = ObjectiveCExampleTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE1A151BDAA10100709011 /* Fixtures */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE1A161BDAA10100709011 /* hello.zip */,
|
||||
8DFE1A171BDAA10100709011 /* IncorrectHeaders.zip */,
|
||||
8DFE1A181BDAA10100709011 /* PermissionsTestApp.app */,
|
||||
8DFE1A191BDAA10100709011 /* RelativeSymbolicLink.zip */,
|
||||
8DFE1A1A1BDAA10100709011 /* SymbolicLink.zip */,
|
||||
8DFE1A1B1BDAA10100709011 /* TestArchive.zip */,
|
||||
8DFE1A1C1BDAA10100709011 /* TestPasswordArchive.zip */,
|
||||
8DFE1A1D1BDAA10100709011 /* Unicode.zip */,
|
||||
);
|
||||
path = Fixtures;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE1A1E1BDAA10100709011 /* Multi_Zip_Test */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE1A1F1BDAA10100709011 /* 0.m4a */,
|
||||
8DFE1A201BDAA10100709011 /* 1.m4a */,
|
||||
8DFE1A211BDAA10100709011 /* 2.m4a */,
|
||||
8DFE1A221BDAA10100709011 /* 3.m4a */,
|
||||
8DFE1A231BDAA10100709011 /* 4.m4a */,
|
||||
8DFE1A241BDAA10100709011 /* 5.m4a */,
|
||||
8DFE1A251BDAA10100709011 /* 6.m4a */,
|
||||
8DFE1A261BDAA10100709011 /* 7.m4a */,
|
||||
);
|
||||
path = Multi_Zip_Test;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9DAA2CA8E954AC9481CC795C /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
55A83C5BCB33C184EAB6A4E4 /* Pods_ObjectiveCExample.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BCB342A5EC26DB692D25F7D4 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1D19A4CE2C2507826BBF65B2 /* Pods-ObjectiveCExample.debug.xcconfig */,
|
||||
D8928CF7ED12679FE72CDF96 /* Pods-ObjectiveCExample.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8DFE19E91BDA9FF300709011 /* ObjectiveCExample */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 8DFE1A0C1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExample" */;
|
||||
buildPhases = (
|
||||
9DD791BB0AF1B25DAC39CA6E /* Check Pods Manifest.lock */,
|
||||
8DFE19E61BDA9FF300709011 /* Sources */,
|
||||
8DFE19E71BDA9FF300709011 /* Frameworks */,
|
||||
8DFE19E81BDA9FF300709011 /* Resources */,
|
||||
46297D8971768D8719ECE6DF /* Embed Pods Frameworks */,
|
||||
2CFF892408F7E8BF9EC5C1C5 /* Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = ObjectiveCExample;
|
||||
productName = ObjectiveCExample;
|
||||
productReference = 8DFE19EA1BDA9FF300709011 /* ObjectiveCExample.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
8DFE1A021BDA9FF300709011 /* ObjectiveCExampleTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 8DFE1A0F1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests" */;
|
||||
buildPhases = (
|
||||
8DFE19FF1BDA9FF300709011 /* Sources */,
|
||||
8DFE1A001BDA9FF300709011 /* Frameworks */,
|
||||
8DFE1A011BDA9FF300709011 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
8DFE1A051BDA9FF300709011 /* PBXTargetDependency */,
|
||||
);
|
||||
name = ObjectiveCExampleTests;
|
||||
productName = ObjectiveCExampleTests;
|
||||
productReference = 8DFE1A031BDA9FF300709011 /* ObjectiveCExampleTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
8DFE19E21BDA9FF300709011 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0710;
|
||||
TargetAttributes = {
|
||||
8DFE19E91BDA9FF300709011 = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
};
|
||||
8DFE1A021BDA9FF300709011 = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
TestTargetID = 8DFE19E91BDA9FF300709011;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 8DFE19E51BDA9FF300709011 /* Build configuration list for PBXProject "ObjectiveCExample" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 8DFE19E11BDA9FF300709011;
|
||||
productRefGroup = 8DFE19EB1BDA9FF300709011 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8DFE19E91BDA9FF300709011 /* ObjectiveCExample */,
|
||||
8DFE1A021BDA9FF300709011 /* ObjectiveCExampleTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
8DFE19E81BDA9FF300709011 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DFE19FD1BDA9FF300709011 /* LaunchScreen.storyboard in Resources */,
|
||||
8DFE19FA1BDA9FF300709011 /* Assets.xcassets in Resources */,
|
||||
8DFE19F81BDA9FF300709011 /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8DFE1A011BDA9FF300709011 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DFE1A321BDAA10100709011 /* 3.m4a in Resources */,
|
||||
8DFE1A311BDAA10100709011 /* 2.m4a in Resources */,
|
||||
8DFE1A331BDAA10100709011 /* 4.m4a in Resources */,
|
||||
8DFE1A2F1BDAA10100709011 /* 0.m4a in Resources */,
|
||||
8DFE1A341BDAA10100709011 /* 5.m4a in Resources */,
|
||||
8DFE1A2D1BDAA10100709011 /* TestPasswordArchive.zip in Resources */,
|
||||
8DFE1A301BDAA10100709011 /* 1.m4a in Resources */,
|
||||
8DFE1A281BDAA10100709011 /* IncorrectHeaders.zip in Resources */,
|
||||
8DFE1A2A1BDAA10100709011 /* RelativeSymbolicLink.zip in Resources */,
|
||||
8DFE1A2E1BDAA10100709011 /* Unicode.zip in Resources */,
|
||||
8DFE1A2C1BDAA10100709011 /* TestArchive.zip in Resources */,
|
||||
8DFE1A271BDAA10100709011 /* hello.zip in Resources */,
|
||||
8DFE1A361BDAA10100709011 /* 7.m4a in Resources */,
|
||||
8DFE1A351BDAA10100709011 /* 6.m4a in Resources */,
|
||||
8DFE1A2B1BDAA10100709011 /* SymbolicLink.zip in Resources */,
|
||||
8DFE1A291BDAA10100709011 /* PermissionsTestApp.app in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
2CFF892408F7E8BF9EC5C1C5 /* Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
46297D8971768D8719ECE6DF /* Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ObjectiveCExample/Pods-ObjectiveCExample-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9DD791BB0AF1B25DAC39CA6E /* Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8DFE19E61BDA9FF300709011 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DFE19F51BDA9FF300709011 /* ViewController.m in Sources */,
|
||||
8DFE19F21BDA9FF300709011 /* AppDelegate.m in Sources */,
|
||||
8DFE19EF1BDA9FF300709011 /* main.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8DFE19FF1BDA9FF300709011 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DFE1A141BDAA0A800709011 /* CollectingDelegate.m in Sources */,
|
||||
8DFE1A081BDA9FF300709011 /* SSZipArchiveTests.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
8DFE1A051BDA9FF300709011 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 8DFE19E91BDA9FF300709011 /* ObjectiveCExample */;
|
||||
targetProxy = 8DFE1A041BDA9FF300709011 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
8DFE19F61BDA9FF300709011 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
8DFE19F71BDA9FF300709011 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE19FB1BDA9FF300709011 /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
8DFE19FC1BDA9FF300709011 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
8DFE1A0A1BDA9FF300709011 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
8DFE1A0B1BDA9FF300709011 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
8DFE1A0D1BDA9FF300709011 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 1D19A4CE2C2507826BBF65B2 /* Pods-ObjectiveCExample.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = ObjectiveCExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
8DFE1A0E1BDA9FF300709011 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D8928CF7ED12679FE72CDF96 /* Pods-ObjectiveCExample.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = ObjectiveCExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
8DFE1A101BDA9FF300709011 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExampleTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObjectiveCExample.app/ObjectiveCExample";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
8DFE1A111BDA9FF300709011 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = ObjectiveCExampleTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.ObjectiveCExampleTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObjectiveCExample.app/ObjectiveCExample";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
8DFE19E51BDA9FF300709011 /* Build configuration list for PBXProject "ObjectiveCExample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
8DFE1A0A1BDA9FF300709011 /* Debug */,
|
||||
8DFE1A0B1BDA9FF300709011 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
8DFE1A0C1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
8DFE1A0D1BDA9FF300709011 /* Debug */,
|
||||
8DFE1A0E1BDA9FF300709011 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
8DFE1A0F1BDA9FF300709011 /* Build configuration list for PBXNativeTarget "ObjectiveCExampleTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
8DFE1A101BDA9FF300709011 /* Debug */,
|
||||
8DFE1A111BDA9FF300709011 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 8DFE19E21BDA9FF300709011 /* Project object */;
|
||||
}
|
||||
7
ObjectiveCExample/ObjectiveCExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
ObjectiveCExample/ObjectiveCExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:ObjectiveCExample.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
10
ObjectiveCExample/ObjectiveCExample.xcworkspace/contents.xcworkspacedata
generated
Normal file
10
ObjectiveCExample/ObjectiveCExample.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:ObjectiveCExample.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
17
ObjectiveCExample/ObjectiveCExample/AppDelegate.h
Normal file
17
ObjectiveCExample/ObjectiveCExample/AppDelegate.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// AppDelegate.h
|
||||
// ObjectiveCExample
|
||||
//
|
||||
// Created by Sean Soper on 10/23/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
45
ObjectiveCExample/ObjectiveCExample/AppDelegate.m
Normal file
45
ObjectiveCExample/ObjectiveCExample/AppDelegate.m
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// AppDelegate.m
|
||||
// ObjectiveCExample
|
||||
//
|
||||
// Created by Sean Soper on 10/23/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@interface AppDelegate ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// Override point for customization after application launch.
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<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"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
47
ObjectiveCExample/ObjectiveCExample/Info.plist
Normal file
47
ObjectiveCExample/ObjectiveCExample/Info.plist
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
15
ObjectiveCExample/ObjectiveCExample/ViewController.h
Normal file
15
ObjectiveCExample/ObjectiveCExample/ViewController.h
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// ViewController.h
|
||||
// ObjectiveCExample
|
||||
//
|
||||
// Created by Sean Soper on 10/23/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
|
||||
|
||||
@end
|
||||
|
||||
27
ObjectiveCExample/ObjectiveCExample/ViewController.m
Normal file
27
ObjectiveCExample/ObjectiveCExample/ViewController.m
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// ViewController.m
|
||||
// ObjectiveCExample
|
||||
//
|
||||
// Created by Sean Soper on 10/23/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "ViewController.h"
|
||||
|
||||
@interface ViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation ViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
@end
|
||||
16
ObjectiveCExample/ObjectiveCExample/main.m
Normal file
16
ObjectiveCExample/ObjectiveCExample/main.m
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// main.m
|
||||
// ObjectiveCExample
|
||||
//
|
||||
// Created by Sean Soper on 10/23/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <SSZipArchive/SSZipArchive.h>
|
||||
|
||||
/**
|
||||
* Test delegate by collecting its calls
|
||||
*/
|
||||
@interface CollectingDelegate : NSObject <SSZipArchiveDelegate>
|
||||
@property(nonatomic, retain) NSMutableArray *files;
|
||||
@end
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// Created by chris on 8/1/12.
|
||||
//
|
||||
// To change the template use AppCode | Preferences | File Templates.
|
||||
//
|
||||
|
||||
|
||||
#import "CollectingDelegate.h"
|
||||
|
||||
@implementation CollectingDelegate {
|
||||
|
||||
}
|
||||
@synthesize files = _files;
|
||||
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.files = [NSMutableArray array];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath {
|
||||
[self.files addObject:entryPath];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>13A476u</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>TestProject</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.squaredtiki.TestProject</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>TestProject</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>5A11314m</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>13A476n</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.9</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0500</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>5A11314m</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.9</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2013 TestBench. All rights reserved.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
APPL????
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\paperw9840\paperh8400
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
|
||||
|
||||
\f0\b\fs24 \cf0 Engineering:
|
||||
\b0 \
|
||||
Some people\
|
||||
\
|
||||
|
||||
\b Human Interface Design:
|
||||
\b0 \
|
||||
Some other people\
|
||||
\
|
||||
|
||||
\b Testing:
|
||||
\b0 \
|
||||
Hopefully not nobody\
|
||||
\
|
||||
|
||||
\b Documentation:
|
||||
\b0 \
|
||||
Whoever\
|
||||
\
|
||||
|
||||
\b With special thanks to:
|
||||
\b0 \
|
||||
Mom\
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
ObjectiveCExample/ObjectiveCExampleTests/Fixtures/hello.zip
Normal file
BIN
ObjectiveCExample/ObjectiveCExampleTests/Fixtures/hello.zip
Normal file
Binary file not shown.
@@ -5,11 +5,13 @@
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.samsoffes.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/0.m4a
Executable file
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/0.m4a
Executable file
Binary file not shown.
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/1.m4a
Executable file
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/1.m4a
Executable file
Binary file not shown.
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/2.m4a
Executable file
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/2.m4a
Executable file
Binary file not shown.
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/3.m4a
Executable file
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/3.m4a
Executable file
Binary file not shown.
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/4.m4a
Executable file
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/4.m4a
Executable file
Binary file not shown.
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/5.m4a
Executable file
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/5.m4a
Executable file
Binary file not shown.
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/6.m4a
Executable file
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/6.m4a
Executable file
Binary file not shown.
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/7.m4a
Executable file
BIN
ObjectiveCExample/ObjectiveCExampleTests/Multi_Zip_Test/7.m4a
Executable file
Binary file not shown.
414
ObjectiveCExample/ObjectiveCExampleTests/SSZipArchiveTests.m
Normal file
414
ObjectiveCExample/ObjectiveCExampleTests/SSZipArchiveTests.m
Normal file
@@ -0,0 +1,414 @@
|
||||
//
|
||||
// SSZipArchiveTests.m
|
||||
// SSZipArchiveTests
|
||||
//
|
||||
// Created by Sam Soffes on 10/3/11.
|
||||
// Copyright (c) 2011-2014 Sam Soffes. All rights reserved.
|
||||
//
|
||||
|
||||
#import <SSZipArchive/SSZipArchive.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
#import "CollectingDelegate.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
|
||||
|
||||
@implementation CancelDelegate
|
||||
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
|
||||
{
|
||||
_numFilesUnzipped = fileIndex + 1;
|
||||
}
|
||||
- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
|
||||
{
|
||||
//return YES;
|
||||
return _numFilesUnzipped < _numFilesToUnzip;
|
||||
}
|
||||
- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath
|
||||
{
|
||||
_didUnzipArchive = YES;
|
||||
}
|
||||
- (void)zipArchiveProgressEvent:(NSInteger)loaded total:(NSInteger)total
|
||||
{
|
||||
_loaded = (int)loaded;
|
||||
_total = (int)total;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface SSZipArchiveTests : XCTestCase <SSZipArchiveDelegate>
|
||||
@end
|
||||
|
||||
@implementation SSZipArchiveTests {
|
||||
NSMutableArray *progressEvents;
|
||||
}
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
progressEvents = [NSMutableArray array];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
[super tearDown];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:[self _cachesPath:nil] error:nil];
|
||||
}
|
||||
|
||||
|
||||
- (void)testZipping {
|
||||
// use extracted files from [-testUnzipping]
|
||||
NSString *inputPath = [self _cachesPath:@"Regular"];
|
||||
NSArray *inputPaths = @[[inputPath stringByAppendingPathComponent:@"Readme.markdown"],
|
||||
[inputPath stringByAppendingPathComponent:@"LICENSE"]];
|
||||
|
||||
NSString *outputPath = [self _cachesPath:@"Zipped"];
|
||||
|
||||
NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedArchive.zip"];
|
||||
[SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
|
||||
|
||||
// TODO: Make sure the files are actually unzipped. They are, but the test should be better.
|
||||
XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Archive created");
|
||||
}
|
||||
|
||||
|
||||
- (void)testDirectoryZipping {
|
||||
// use Unicode as folder (has a file in root and a file in subfolder)
|
||||
NSString *inputPath = [self _cachesPath:@"Unicode"];
|
||||
|
||||
NSString *outputPath = [self _cachesPath:@"FolderZipped"];
|
||||
NSString *archivePath = [outputPath stringByAppendingPathComponent:@"ArchiveWithFolders.zip"];
|
||||
|
||||
[SSZipArchive createZipFileAtPath:archivePath withContentsOfDirectory:inputPath];
|
||||
XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Folder Archive created");
|
||||
}
|
||||
|
||||
- (void)testMultipleZippping{
|
||||
NSArray *inputPaths = @[[[NSBundle bundleForClass: [self class]]pathForResource:@"0" ofType:@"m4a"],
|
||||
|
||||
[[NSBundle bundleForClass: [self class]]pathForResource:@"1" ofType:@"m4a"],
|
||||
[[NSBundle bundleForClass: [self class]]pathForResource:@"2" ofType:@"m4a"],
|
||||
[[NSBundle bundleForClass: [self class]]pathForResource:@"3" ofType:@"m4a"],
|
||||
[[NSBundle bundleForClass: [self class]]pathForResource:@"4" ofType:@"m4a"],
|
||||
[[NSBundle bundleForClass: [self class]]pathForResource:@"5" ofType:@"m4a"],
|
||||
[[NSBundle bundleForClass: [self class]]pathForResource:@"6" ofType:@"m4a"],
|
||||
[[NSBundle bundleForClass: [self class]]pathForResource:@"7" ofType:@"m4a"]
|
||||
];
|
||||
NSString *outputPath = [self _cachesPath:@"Zipped"];
|
||||
|
||||
// this is a monster
|
||||
// if testing on iOS, within 30 loops it will fail; however, on OS X, it may take about 900 loops
|
||||
for (int test = 0; test < 20; test++)
|
||||
{
|
||||
// Zipping
|
||||
NSString *archivePath = [outputPath stringByAppendingPathComponent:[NSString stringWithFormat:@"queue_test_%d.zip",test]];
|
||||
|
||||
[SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
|
||||
|
||||
long long threshold = 510000; // 510kB:size slightly smaller than a successful zip, but much larger than a failed one
|
||||
long long fileSize = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:nil][NSFileSize] longLongValue];
|
||||
XCTAssertTrue(fileSize > threshold, @"zipping failed at %@!",archivePath);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)testUnzipping {
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Regular"];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
|
||||
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped");
|
||||
|
||||
testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"];
|
||||
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped");
|
||||
}
|
||||
- (void)testSmallFileUnzipping {
|
||||
NSString *zipPath = [[NSBundle bundleForClass: [self class]] pathForResource:@"TestArchive" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Regular"];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
|
||||
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped");
|
||||
|
||||
testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"];
|
||||
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped");
|
||||
}
|
||||
- (void)testUnzippingProgress {
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Progress"];
|
||||
|
||||
[progressEvents removeAllObjects];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
// 4 events: the first, then for each of the two files one, then the final event
|
||||
XCTAssertTrue(4 == [progressEvents count], @"Expected 4 progress events");
|
||||
XCTAssertTrue(0 == [progressEvents[0] intValue]);
|
||||
XCTAssertTrue(619 == [progressEvents[1] intValue]);
|
||||
XCTAssertTrue(1114 == [progressEvents[2] intValue]);
|
||||
XCTAssertTrue(1436 == [progressEvents[3] intValue]);
|
||||
}
|
||||
|
||||
|
||||
- (void)testUnzippingWithPassword {
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestPasswordArchive" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Password"];
|
||||
|
||||
NSError *error = nil;
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd" error:&error delegate:self];
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
|
||||
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped");
|
||||
|
||||
testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"];
|
||||
XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped");
|
||||
}
|
||||
|
||||
|
||||
- (void)testUnzippingTruncatedFileFix {
|
||||
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"IncorrectHeaders" ofType:@"zip"];
|
||||
NSString* outputPath = [self _cachesPath:@"IncorrectHeaders"];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
NSString* intendedReadmeTxtMD5 = @"31ac96301302eb388070c827447290b5";
|
||||
|
||||
NSString* filePath = [outputPath stringByAppendingPathComponent:@"IncorrectHeaders/Readme.txt"];
|
||||
NSData* data = [NSData dataWithContentsOfFile:filePath];
|
||||
|
||||
NSString* actualReadmeTxtMD5 = [self _calculateMD5Digest:data];
|
||||
XCTAssertTrue([actualReadmeTxtMD5 isEqualToString:intendedReadmeTxtMD5], @"Readme.txt MD5 digest should match original.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testUnzippingWithSymlinkedFileInside {
|
||||
|
||||
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"SymbolicLink" ofType:@"zip"];
|
||||
NSString* outputPath = [self _cachesPath:@"SymbolicLink"];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
NSString *testSymlink = [outputPath stringByAppendingPathComponent:@"SymbolicLink/Xcode.app"];
|
||||
|
||||
NSError *error = nil;
|
||||
NSDictionary *info = [[NSFileManager defaultManager] attributesOfItemAtPath: testSymlink error: &error];
|
||||
|
||||
XCTAssertTrue(info, @"Symbolic links should persist from the original archive to the outputted files.");
|
||||
}
|
||||
|
||||
- (void)testUnzippingWithRelativeSymlink {
|
||||
|
||||
NSString *resourceName = @"RelativeSymbolicLink";
|
||||
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:resourceName ofType:@"zip"];
|
||||
NSString* outputPath = [self _cachesPath:resourceName];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
// Determine where the symlinks are
|
||||
NSString *subfolderName = @"symlinks";
|
||||
NSString *testBasePath = [NSString pathWithComponents:@[outputPath]];
|
||||
NSString *testSymlinkFolder = [NSString pathWithComponents:@[testBasePath, subfolderName, @"folderSymlink"]];
|
||||
NSString *testSymlinkFile = [NSString pathWithComponents:@[testBasePath, subfolderName, @"fileSymlink"]];
|
||||
|
||||
BOOL found = [[NSFileManager defaultManager] attributesOfItemAtPath: testSymlinkFile error: nil];
|
||||
|
||||
XCTAssertTrue(found, @"Relative symbolic links should persist from the original archive to the outputted files (and also remain relative).");
|
||||
|
||||
found = [[NSFileManager defaultManager] attributesOfItemAtPath: testSymlinkFolder error: nil];
|
||||
|
||||
XCTAssertTrue(found, @"Relative symbolic links should persist from the original archive to the outputted files (and also remain relative).");
|
||||
}
|
||||
|
||||
- (void)testUnzippingWithUnicodeFilenameInside {
|
||||
|
||||
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"Unicode" ofType:@"zip"];
|
||||
NSString* outputPath = [self _cachesPath:@"Unicode"];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
bool unicodeFilenameWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Accént.txt"]];
|
||||
|
||||
bool unicodeFolderWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Fólder/Nothing.txt"]];
|
||||
|
||||
XCTAssertTrue(unicodeFilenameWasExtracted, @"Files with filenames in unicode should be extracted properly.");
|
||||
XCTAssertTrue(unicodeFolderWasExtracted, @"Folders with names in unicode should be extracted propertly.");
|
||||
}
|
||||
|
||||
|
||||
- (void)testZippingAndUnzippingForDate {
|
||||
|
||||
NSString *inputPath = [self _cachesPath:@"Regular"];
|
||||
NSArray *inputPaths = @[[inputPath stringByAppendingPathComponent:@"Readme.markdown"]];
|
||||
|
||||
NSDictionary *originalFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[inputPath stringByAppendingPathComponent:@"Readme.markdown"] error:nil];
|
||||
|
||||
NSString *outputPath = [self _cachesPath:@"ZippedDate"];
|
||||
NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedArchive.zip"];
|
||||
|
||||
[SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
|
||||
[SSZipArchive unzipFileAtPath:archivePath toDestination:outputPath delegate:self];
|
||||
|
||||
NSDictionary *createdFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[outputPath stringByAppendingPathComponent:@"Readme.markdown"] error:nil];
|
||||
|
||||
XCTAssertEqualObjects(originalFileAttributes[NSFileCreationDate], createdFileAttributes[@"NSFileCreationDate"], @"Orginal file creationDate should match created one");
|
||||
}
|
||||
|
||||
|
||||
- (void)testZippingAndUnzippingForPermissions {
|
||||
// File we're going to test permissions on before and after zipping
|
||||
NSString *targetFile = @"/Contents/MacOS/TestProject";
|
||||
|
||||
|
||||
/********** Zipping ********/
|
||||
|
||||
// The .app file we're going to zip up
|
||||
NSString *inputFile = [[NSBundle bundleForClass: [self class]] pathForResource:@"PermissionsTestApp" ofType:@"app"];
|
||||
|
||||
// The path to the target file in the app before zipping
|
||||
NSString *targetFilePreZipPath = [inputFile stringByAppendingPathComponent:targetFile];
|
||||
|
||||
// Atribtues for the target file before zipping
|
||||
NSDictionary *preZipAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:targetFilePreZipPath error:nil];
|
||||
|
||||
// Directory to output our created zip file
|
||||
NSString *outputDir = [self _cachesPath:@"PermissionsTest"];
|
||||
// The path to where the archive shall be created
|
||||
NSString *archivePath = [outputDir stringByAppendingPathComponent:@"TestAppArchive.zip"];
|
||||
|
||||
// Create the zip file using the contents of the .app file as the input
|
||||
[SSZipArchive createZipFileAtPath:archivePath withContentsOfDirectory:inputFile];
|
||||
|
||||
|
||||
/********** Un-zipping *******/
|
||||
|
||||
// Using this newly created zip file, unzip it
|
||||
[SSZipArchive unzipFileAtPath:archivePath toDestination:outputDir];
|
||||
|
||||
// Get the path to the target file after unzipping
|
||||
NSString *targetFilePath = [outputDir stringByAppendingPathComponent:@"/Contents/MacOS/TestProject"];
|
||||
|
||||
// Get the file attributes of the target file following the unzipping
|
||||
NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:targetFilePath error:nil];
|
||||
|
||||
// Compare the value of the permissions attribute to assert equality
|
||||
XCTAssertEqual(fileAttributes[NSFilePosixPermissions], preZipAttributes[NSFilePosixPermissions], @"File permissions should be retained during compression and de-compression");
|
||||
}
|
||||
|
||||
- (void)testUnzippingWithCancel {
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Cancel1"];
|
||||
|
||||
CancelDelegate *delegate = [[CancelDelegate alloc] init];
|
||||
delegate.numFilesToUnzip = 1;
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
|
||||
|
||||
XCTAssertEqual(delegate.numFilesUnzipped, 1);
|
||||
XCTAssertFalse(delegate.didUnzipArchive);
|
||||
XCTAssertNotEqual(delegate.loaded, delegate.total);
|
||||
|
||||
outputPath = [self _cachesPath:@"Cancel2"];
|
||||
|
||||
delegate = [[CancelDelegate alloc] init];
|
||||
delegate.numFilesToUnzip = 1000;
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:delegate];
|
||||
|
||||
XCTAssertEqual(delegate.numFilesUnzipped, 2);
|
||||
XCTAssertTrue(delegate.didUnzipArchive);
|
||||
XCTAssertEqual(delegate.loaded, delegate.total);
|
||||
|
||||
}
|
||||
|
||||
// Commented out to avoid checking in several gig file into the repository. Simply add a file named
|
||||
// `LargeArchive.zip` to the project and uncomment out these lines to test.
|
||||
//
|
||||
//- (void)testUnzippingLargeFiles {
|
||||
// NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"LargeArchive" ofType:@"zip"];
|
||||
// NSString *outputPath = [self _cachesPath:@"Large"];
|
||||
//
|
||||
// [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath];
|
||||
//}
|
||||
|
||||
-(void)testShouldProvidePathOfUnzippedFileInDelegateCallback {
|
||||
CollectingDelegate *collector = [CollectingDelegate new];
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Regular"];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:collector];
|
||||
|
||||
// STAssertEqualObjects([collector.files objectAtIndex:0], @"LICENSE.txt", nil);
|
||||
// STAssertEqualObjects([collector.files objectAtIndex:1], @"README.md", nil);
|
||||
}
|
||||
|
||||
#pragma mark - SSZipArchiveDelegate
|
||||
|
||||
- (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo {
|
||||
NSLog(@"*** zipArchiveWillUnzipArchiveAtPath: `%@` zipInfo:", path);
|
||||
}
|
||||
|
||||
|
||||
- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath {
|
||||
NSLog(@"*** zipArchiveDidUnzipArchiveAtPath: `%@` zipInfo: unzippedPath: `%@`", path, unzippedPath);
|
||||
}
|
||||
|
||||
- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo
|
||||
{
|
||||
NSLog(@"*** zipArchiveShouldUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo {
|
||||
NSLog(@"*** zipArchiveWillUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath);
|
||||
}
|
||||
|
||||
|
||||
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo {
|
||||
NSLog(@"*** zipArchiveDidUnzipFileAtIndex: `%d` totalFiles: `%d` archivePath: `%@` fileInfo:", (int)fileIndex, (int)totalFiles, archivePath);
|
||||
}
|
||||
|
||||
- (void)zipArchiveProgressEvent:(NSInteger)loaded total:(NSInteger)total {
|
||||
NSLog(@"*** zipArchiveProgressEvent: loaded: `%d` total: `%d`", (int)loaded, (int)total);
|
||||
[progressEvents addObject:@(loaded)];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (NSString *)_cachesPath:(NSString *)directory {
|
||||
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]
|
||||
stringByAppendingPathComponent:@"com.samsoffes.ssziparchive.tests"];
|
||||
if (directory) {
|
||||
path = [path stringByAppendingPathComponent:directory];
|
||||
}
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
if (![fileManager fileExistsAtPath:path]) {
|
||||
[fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
// Taken from https://github.com/samsoffes/sstoolkit/blob/master/SSToolkit/NSData+SSToolkitAdditions.m
|
||||
- (NSString *)_calculateMD5Digest:(NSData *)data {
|
||||
unsigned char digest[CC_MD5_DIGEST_LENGTH], i;
|
||||
CC_MD5(data.bytes, (unsigned int)data.length, digest);
|
||||
NSMutableString *ms = [NSMutableString string];
|
||||
for (i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
|
||||
[ms appendFormat: @"%02x", (int)(digest[i])];
|
||||
}
|
||||
return [ms copy];
|
||||
}
|
||||
|
||||
@end
|
||||
8
ObjectiveCExample/Podfile
Normal file
8
ObjectiveCExample/Podfile
Normal file
@@ -0,0 +1,8 @@
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
|
||||
# inhibit_all_warnings!
|
||||
use_frameworks!
|
||||
|
||||
target 'ObjectiveCExample' do
|
||||
pod 'SSZipArchive', :path => '..'
|
||||
end
|
||||
14
ObjectiveCExample/Podfile.lock
Normal file
14
ObjectiveCExample/Podfile.lock
Normal file
@@ -0,0 +1,14 @@
|
||||
PODS:
|
||||
- SSZipArchive (0.3.2)
|
||||
|
||||
DEPENDENCIES:
|
||||
- SSZipArchive (from `..`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
SSZipArchive:
|
||||
:path: ".."
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
SSZipArchive: 0f61dba1ab479a636f095aaf75a6cdafb5ff9d0c
|
||||
|
||||
COCOAPODS: 0.39.0
|
||||
53
README.md
Normal file
53
README.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# SSZipArchive
|
||||
|
||||
ZipArchive is a simple utility class for zipping and unzipping files on iOS and Mac.
|
||||
|
||||
- Unzip zip files;
|
||||
- Unzip password protected zip files;
|
||||
- Create new zip files;
|
||||
- Append to existing zip files;
|
||||
- Zip files;
|
||||
- Zip-up NSData instances. (with a filename)
|
||||
|
||||
## Installation and Setup
|
||||
|
||||
### CocoaPods
|
||||
|
||||
`pod install SSZipArchive`
|
||||
|
||||
### Manual
|
||||
|
||||
1. Add the `SSZipArchive` and `minizip` folders to your project.
|
||||
2. Add the `libz` library to your target
|
||||
|
||||
SSZipArchive requires ARC.
|
||||
|
||||
## Usage
|
||||
|
||||
### Objective-C
|
||||
|
||||
```objective-c
|
||||
// Create
|
||||
[SSZipArchive createZipFileAtPath: zipPath withContentsOfDirectory: sampleDataPath];
|
||||
|
||||
// Unzip
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination: unzipPath];
|
||||
```
|
||||
|
||||
### Swift
|
||||
|
||||
```swift
|
||||
// Create
|
||||
SSZipArchive.createZipFileAtPath(zipPath, withContentsOfDirectory: sampleDataPath)
|
||||
|
||||
// Unzip
|
||||
SSZipArchive.unzipFileAtPath(zipPath, toDestination: unzipPath)
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
SSZipArchive is protected under the [MIT license](https://github.com/samsoffes/ssziparchive/raw/master/LICENSE) and our slightly modified version of [Minizip](http://www.winimage.com/zLibDll/minizip.html) 1.1 is licensed under the [Zlib license](http://www.zlib.net/zlib_license.html).
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
Big thanks to [aish](http://code.google.com/p/ziparchive) for creating [ZipArchive](http://code.google.com/p/ziparchive). The project that inspired SSZipArchive. Thank you [@randomsequence](https://github.com/randomsequence) for implementing the creation support tech and to [@johnezang](https://github.com/johnezang) for all his amazing help along the way.
|
||||
@@ -1,43 +0,0 @@
|
||||
# SSZipArchive
|
||||
|
||||
SSZipArchive is a simple utility class for zipping and unzipping files. Features:
|
||||
|
||||
* Unzipping zip files
|
||||
* Unzipping password protected zip files
|
||||
* Creating zip files
|
||||
* Appending to zip files
|
||||
* Zipping files
|
||||
* Zipping NSData with a filename
|
||||
* Works in ARC and non-ARC projects
|
||||
|
||||
## Adding to your project
|
||||
|
||||
1. Add `SSZipArchive.h`, `SSZipArchive.m`, and `minizip` to your project.
|
||||
2. Add the `libz` library to your target
|
||||
|
||||
You don't need to do anything regarding ARC. SSZipArchive will detect if you're not using ARC and add the required memory management code.
|
||||
|
||||
## Usage
|
||||
|
||||
``` objective-c
|
||||
// Unzipping
|
||||
NSString *zipPath = @"path_to_your_zip_file";
|
||||
NSString *destinationPath = @"path_to_the_folder_where_you_want_it_unzipped";
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath];
|
||||
|
||||
// Zipping
|
||||
NSString *zippedPath = @"path_where_you_want_the_file_created";
|
||||
NSArray *inputPaths = [NSArray arrayWithObjects:
|
||||
[[NSBundle mainBundle] pathForResource:@"photo1" ofType:@"jpg"],
|
||||
[[NSBundle mainBundle] pathForResource:@"photo2" ofType:@"jpg"]
|
||||
nil];
|
||||
[SSZipArchive createZipFileAtPath:zippedPath withFilesAtPaths:inputPaths];
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
SSZipArchive is licensed under the [MIT license](https://github.com/samsoffes/ssziparchive/raw/master/LICENSE). A slightly modified version of [Minizip](http://www.winimage.com/zLibDll/minizip.html) 1.1 is also included and is licensed under the [Zlib license](http://www.zlib.net/zlib_license.html).
|
||||
|
||||
## Thanks
|
||||
|
||||
Thanks [aish](http://code.google.com/p/ziparchive) for creating [ZipArchive](http://code.google.com/p/ziparchive) which SSZipArchive is based on, Johnnie Walker ([@randomsequence](https://github.com/randomsequence)) for implementing creation support, and John Engelhart ([@johnezang](https://github.com/johnezang)) for all his amazing help along the way.
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// SSZipArchive.h
|
||||
// SSZipArchive
|
||||
//
|
||||
// Created by Sam Soffes on 7/21/10.
|
||||
// Copyright (c) Sam Soffes 2010-2011. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#include "minizip/unzip.h"
|
||||
|
||||
@protocol SSZipArchiveDelegate;
|
||||
|
||||
@interface SSZipArchive : NSObject
|
||||
|
||||
// Unzip
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination;
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error;
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id<SSZipArchiveDelegate>)delegate;
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error delegate:(id<SSZipArchiveDelegate>)delegate;
|
||||
|
||||
// Zip
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)filenames;
|
||||
|
||||
- (id)initWithPath:(NSString *)path;
|
||||
- (BOOL)open;
|
||||
- (BOOL)writeFile:(NSString *)path;
|
||||
- (BOOL)writeData:(NSData *)data filename:(NSString *)filename;
|
||||
- (BOOL)close;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@protocol SSZipArchiveDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
- (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo;
|
||||
- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath;
|
||||
|
||||
- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo;
|
||||
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo;
|
||||
|
||||
@end
|
||||
421
SSZipArchive.m
421
SSZipArchive.m
@@ -1,421 +0,0 @@
|
||||
//
|
||||
// SSZipArchive.m
|
||||
// SSZipArchive
|
||||
//
|
||||
// Created by Sam Soffes on 7/21/10.
|
||||
// Copyright (c) Sam Soffes 2010-2011. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SSZipArchive.h"
|
||||
#include "minizip/zip.h"
|
||||
#import "zlib.h"
|
||||
#import "zconf.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define CHUNK 16384
|
||||
|
||||
@interface SSZipArchive ()
|
||||
+ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime;
|
||||
@end
|
||||
|
||||
|
||||
@implementation SSZipArchive {
|
||||
NSString *_path;
|
||||
NSString *_filename;
|
||||
zipFile _zip;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Unzipping
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination {
|
||||
return [self unzipFileAtPath:path toDestination:destination delegate:nil];
|
||||
}
|
||||
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error {
|
||||
return [self unzipFileAtPath:path toDestination:destination overwrite:overwrite password:password error:error delegate:nil];
|
||||
}
|
||||
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id<SSZipArchiveDelegate>)delegate {
|
||||
return [self unzipFileAtPath:path toDestination:destination overwrite:YES password:nil error:nil delegate:delegate];
|
||||
}
|
||||
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error delegate:(id<SSZipArchiveDelegate>)delegate {
|
||||
// Begin opening
|
||||
zipFile zip = unzOpen((const char*)[path UTF8String]);
|
||||
if (zip == NULL) {
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:@"failed to open zip file" forKey:NSLocalizedDescriptionKey];
|
||||
if (error) {
|
||||
*error = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-1 userInfo:userInfo];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
unz_global_info globalInfo = {0ul, 0ul};
|
||||
unzGetGlobalInfo(zip, &globalInfo);
|
||||
|
||||
// Begin unzipping
|
||||
if (unzGoToFirstFile(zip) != UNZ_OK) {
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:@"failed to open first file in zip file" forKey:NSLocalizedDescriptionKey];
|
||||
if (error) {
|
||||
*error = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-2 userInfo:userInfo];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL success = YES;
|
||||
int ret = 0;
|
||||
unsigned char buffer[4096] = {0};
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSMutableSet *directoriesModificationDates = [[NSMutableSet alloc] init];
|
||||
|
||||
// Message delegate
|
||||
if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipArchiveAtPath:zipInfo:)]) {
|
||||
[delegate zipArchiveWillUnzipArchiveAtPath:path zipInfo:globalInfo];
|
||||
}
|
||||
|
||||
NSInteger currentFileNumber = 0;
|
||||
do {
|
||||
if ([password length] == 0) {
|
||||
ret = unzOpenCurrentFile(zip);
|
||||
} else {
|
||||
ret = unzOpenCurrentFilePassword(zip, [password cStringUsingEncoding:NSASCIIStringEncoding]);
|
||||
}
|
||||
|
||||
if (ret != UNZ_OK) {
|
||||
success = NO;
|
||||
break;
|
||||
}
|
||||
|
||||
// Reading data and write to file
|
||||
unz_file_info fileInfo;
|
||||
memset(&fileInfo, 0, sizeof(unz_file_info));
|
||||
|
||||
ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
|
||||
if (ret != UNZ_OK) {
|
||||
success = NO;
|
||||
unzCloseCurrentFile(zip);
|
||||
break;
|
||||
}
|
||||
|
||||
// Message delegate
|
||||
if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) {
|
||||
[delegate zipArchiveWillUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry
|
||||
archivePath:path fileInfo:fileInfo];
|
||||
}
|
||||
|
||||
char *filename = (char *)malloc(fileInfo.size_filename + 1);
|
||||
unzGetCurrentFileInfo(zip, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0);
|
||||
filename[fileInfo.size_filename] = '\0';
|
||||
|
||||
//
|
||||
// NOTE
|
||||
// I used the ZIP spec from here:
|
||||
// http://www.pkware.com/documents/casestudies/APPNOTE.TXT
|
||||
//
|
||||
// ...to deduce this method of detecting whether the file in the ZIP is a symbolic link.
|
||||
// If it is, it is listed as a directory but has a data size greater than zero (real
|
||||
// directories have it equal to 0) and the included, uncompressed data is the symbolic link path.
|
||||
//
|
||||
// ZIP files did not originally include support for symbolic links so the specification
|
||||
// doesn't include anything in them that isn't part of a unix extension that isn't being used
|
||||
// by the archivers we're testing. Most of this is figured out through trial and error and
|
||||
// reading ZIP headers in hex editors. This seems to do the trick though.
|
||||
//
|
||||
|
||||
const uLong ZipCompressionMethodStore = 0;
|
||||
|
||||
BOOL fileIsSymbolicLink = NO;
|
||||
|
||||
if((fileInfo.compression_method == ZipCompressionMethodStore) && // Is it compressed?
|
||||
(S_ISDIR(fileInfo.external_fa)) && // Is it marked as a directory
|
||||
(fileInfo.compressed_size > 0)) // Is there any data?
|
||||
{
|
||||
fileIsSymbolicLink = YES;
|
||||
}
|
||||
|
||||
// Check if it contains directory
|
||||
NSString *strPath = [NSString stringWithCString:filename encoding:NSUTF8StringEncoding];
|
||||
BOOL isDirectory = NO;
|
||||
if (filename[fileInfo.size_filename-1] == '/' || filename[fileInfo.size_filename-1] == '\\') {
|
||||
isDirectory = YES;
|
||||
}
|
||||
free(filename);
|
||||
|
||||
// Contains a path
|
||||
if ([strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location != NSNotFound) {
|
||||
strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"];
|
||||
}
|
||||
|
||||
NSString *fullPath = [destination stringByAppendingPathComponent:strPath];
|
||||
NSError *err = nil;
|
||||
NSDate *modDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate];
|
||||
NSDictionary *directoryAttr = [NSDictionary dictionaryWithObjectsAndKeys:modDate, NSFileCreationDate, modDate, NSFileModificationDate, nil];
|
||||
|
||||
if (isDirectory) {
|
||||
[fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err];
|
||||
} else {
|
||||
[fileManager createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:directoryAttr error:&err];
|
||||
}
|
||||
if (nil != err) {
|
||||
NSLog(@"[SSZipArchive] Error: %@", err.localizedDescription);
|
||||
}
|
||||
|
||||
if(!fileIsSymbolicLink)
|
||||
[directoriesModificationDates addObject: [NSDictionary dictionaryWithObjectsAndKeys:fullPath, @"path", modDate, @"modDate", nil]];
|
||||
|
||||
if ([fileManager fileExistsAtPath:fullPath] && !isDirectory && !overwrite) {
|
||||
unzCloseCurrentFile(zip);
|
||||
ret = unzGoToNextFile(zip);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!fileIsSymbolicLink)
|
||||
{
|
||||
FILE *fp = fopen((const char*)[fullPath UTF8String], "wb");
|
||||
while (fp) {
|
||||
int readBytes = unzReadCurrentFile(zip, buffer, 4096);
|
||||
|
||||
if (readBytes > 0) {
|
||||
fwrite(buffer, readBytes, 1, fp );
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fp) {
|
||||
fclose(fp);
|
||||
|
||||
// Set the original datetime property
|
||||
if (fileInfo.dosDate != 0) {
|
||||
NSDate *orgDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate];
|
||||
NSDictionary *attr = [NSDictionary dictionaryWithObject:orgDate forKey:NSFileModificationDate];
|
||||
|
||||
if (attr) {
|
||||
if ([fileManager setAttributes:attr ofItemAtPath:fullPath error:nil] == NO) {
|
||||
// Can't set attributes
|
||||
NSLog(@"[SSZipArchive] Failed to set attributes");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the path for the symbolic link
|
||||
|
||||
NSURL* symlinkURL = [NSURL fileURLWithPath:fullPath];
|
||||
NSMutableString* destinationPath = [NSMutableString string];
|
||||
|
||||
int bytesRead = 0;
|
||||
while((bytesRead = unzReadCurrentFile(zip, buffer, 4096)) > 0)
|
||||
{
|
||||
buffer[bytesRead] = 0;
|
||||
[destinationPath appendString:[NSString stringWithUTF8String:(const char*)buffer]];
|
||||
}
|
||||
|
||||
//NSLog(@"Symlinking to: %@", destinationPath);
|
||||
|
||||
NSURL* destinationURL = [NSURL fileURLWithPath:destinationPath];
|
||||
|
||||
// Create the symbolic link
|
||||
NSError* symlinkError = nil;
|
||||
[fileManager createSymbolicLinkAtURL:symlinkURL withDestinationURL:destinationURL error:&symlinkError];
|
||||
|
||||
if(symlinkError != nil)
|
||||
{
|
||||
NSLog(@"Failed to create symbolic link at \"%@\" to \"%@\". Error: %@", symlinkURL.absoluteString, destinationURL.absoluteString, symlinkError.localizedDescription);
|
||||
}
|
||||
}
|
||||
|
||||
unzCloseCurrentFile( zip );
|
||||
ret = unzGoToNextFile( zip );
|
||||
|
||||
// Message delegate
|
||||
if ([delegate respondsToSelector:@selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) {
|
||||
[delegate zipArchiveDidUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry
|
||||
archivePath:path fileInfo:fileInfo];
|
||||
}
|
||||
|
||||
currentFileNumber++;
|
||||
} while(ret == UNZ_OK && UNZ_OK != UNZ_END_OF_LIST_OF_FILE);
|
||||
|
||||
// Close
|
||||
unzClose(zip);
|
||||
|
||||
// The process of decompressing the .zip archive causes the modification times on the folders
|
||||
// to be set to the present time. So, when we are done, they need to be explicitly set.
|
||||
// set the modification date on all of the directories.
|
||||
NSError * err = nil;
|
||||
for (NSDictionary * d in directoriesModificationDates) {
|
||||
if (![[NSFileManager defaultManager] setAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[d objectForKey:@"modDate"], NSFileModificationDate, nil] ofItemAtPath:[d objectForKey:@"path"] error:&err]) {
|
||||
NSLog(@"[SSZipArchive] Set attributes failed for directory: %@.", [d objectForKey:@"path"]);
|
||||
}
|
||||
if (err) {
|
||||
NSLog(@"[SSZipArchive] Error setting directory file modification date attribute: %@",err.localizedDescription);
|
||||
}
|
||||
}
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[directoriesModificationDates release];
|
||||
#endif
|
||||
|
||||
// Message delegate
|
||||
if (success && [delegate respondsToSelector:@selector(zipArchiveDidUnzipArchiveAtPath:zipInfo:unzippedPath:)]) {
|
||||
[delegate zipArchiveDidUnzipArchiveAtPath:path zipInfo:globalInfo unzippedPath:destination];
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Zipping
|
||||
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths {
|
||||
BOOL success = NO;
|
||||
SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path];
|
||||
if ([zipArchive open]) {
|
||||
for (NSString *path in paths) {
|
||||
[zipArchive writeFile:path];
|
||||
}
|
||||
success = [zipArchive close];
|
||||
}
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[zipArchive release];
|
||||
#endif
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
- (id)initWithPath:(NSString *)path {
|
||||
if ((self = [super init])) {
|
||||
_path = [path copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
- (void)dealloc {
|
||||
[_path release];
|
||||
[super dealloc];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
- (BOOL)open {
|
||||
NSAssert((_zip == NULL), @"Attempting open an archive which is already open");
|
||||
_zip = zipOpen([_path UTF8String], APPEND_STATUS_CREATE);
|
||||
return (NULL != _zip);
|
||||
}
|
||||
|
||||
|
||||
- (void)zipInfo:(zip_fileinfo*)zipInfo setDate:(NSDate*)date {
|
||||
NSCalendar *currentCalendar = [NSCalendar currentCalendar];
|
||||
uint flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
|
||||
NSDateComponents *components = [currentCalendar components:flags fromDate:date];
|
||||
zipInfo->tmz_date.tm_sec = (unsigned int)components.second;
|
||||
zipInfo->tmz_date.tm_min = (unsigned int)components.minute;
|
||||
zipInfo->tmz_date.tm_hour = (unsigned int)components.hour;
|
||||
zipInfo->tmz_date.tm_mday = (unsigned int)components.day;
|
||||
zipInfo->tmz_date.tm_mon = (unsigned int)components.month - 1;
|
||||
zipInfo->tmz_date.tm_year = (unsigned int)components.year;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)writeFile:(NSString *)path {
|
||||
NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened");
|
||||
|
||||
FILE *input = fopen([path UTF8String], "r");
|
||||
if (NULL == input) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
zipOpenNewFileInZip(_zip, [[path lastPathComponent] UTF8String], NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED,
|
||||
Z_DEFAULT_COMPRESSION);
|
||||
|
||||
void *buffer = malloc(CHUNK);
|
||||
unsigned int len = 0;
|
||||
while (!feof(input)) {
|
||||
len = (unsigned int) fread(buffer, 1, CHUNK, input);
|
||||
zipWriteInFileInZip(_zip, buffer, len);
|
||||
}
|
||||
|
||||
zipCloseFileInZip(_zip);
|
||||
free(buffer);
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)writeData:(NSData *)data filename:(NSString *)filename {
|
||||
if (!_zip) {
|
||||
return NO;
|
||||
}
|
||||
if (!data) {
|
||||
return NO;
|
||||
}
|
||||
zip_fileinfo zipInfo = {{0,0,0,0,0,0},0,0,0};
|
||||
[self zipInfo:&zipInfo setDate:[NSDate date]];
|
||||
|
||||
zipOpenNewFileInZip(_zip, [filename UTF8String], &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
||||
|
||||
zipWriteInFileInZip(_zip, data.bytes, (unsigned int)data.length);
|
||||
|
||||
zipCloseFileInZip(_zip);
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)close {
|
||||
NSAssert((_zip != NULL), @"[SSZipArchive] Attempting to close an archive which was never opened");
|
||||
zipClose(_zip, NULL);
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
// Format from http://newsgroups.derkeiler.com/Archive/Comp/comp.os.msdos.programmer/2009-04/msg00060.html
|
||||
// Two consecutive words, or a longword, YYYYYYYMMMMDDDDD hhhhhmmmmmmsssss
|
||||
// YYYYYYY is years from 1980 = 0
|
||||
// sssss is (seconds/2).
|
||||
//
|
||||
// 3658 = 0011 0110 0101 1000 = 0011011 0010 11000 = 27 2 24 = 2007-02-24
|
||||
// 7423 = 0111 0100 0010 0011 - 01110 100001 00011 = 14 33 2 = 14:33:06
|
||||
+ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime {
|
||||
static const UInt32 kYearMask = 0xFE000000;
|
||||
static const UInt32 kMonthMask = 0x1E00000;
|
||||
static const UInt32 kDayMask = 0x1F0000;
|
||||
static const UInt32 kHourMask = 0xF800;
|
||||
static const UInt32 kMinuteMask = 0x7E0;
|
||||
static const UInt32 kSecondMask = 0x1F;
|
||||
|
||||
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
|
||||
NSDateComponents *components = [[NSDateComponents alloc] init];
|
||||
|
||||
NSAssert(0xFFFFFFFF == (kYearMask | kMonthMask | kDayMask | kHourMask | kMinuteMask | kSecondMask), @"[SSZipArchive] MSDOS date masks don't add up");
|
||||
|
||||
[components setYear:1980 + ((msdosDateTime & kYearMask) >> 25)];
|
||||
[components setMonth:(msdosDateTime & kMonthMask) >> 21];
|
||||
[components setDay:(msdosDateTime & kDayMask) >> 16];
|
||||
[components setHour:(msdosDateTime & kHourMask) >> 11];
|
||||
[components setMinute:(msdosDateTime & kMinuteMask) >> 5];
|
||||
[components setSecond:(msdosDateTime & kSecondMask) * 2];
|
||||
|
||||
NSDate *date = [NSDate dateWithTimeInterval:0 sinceDate:[gregorian dateFromComponents:components]];
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[gregorian release];
|
||||
[components release];
|
||||
#endif
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,18 +1,16 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'SSZipArchive'
|
||||
s.version = '0.2.2'
|
||||
s.summary = 'Utility class for zipping and unzipping files on iOS and Mac.'
|
||||
s.homepage = 'https://github.com/samsoffes/ssziparchive'
|
||||
s.author = { 'Sam Soffes' => 'sam@samsoff.es' }
|
||||
s.source = { :git => 'https://github.com/samsoffes/ssziparchive.git', :tag => '0.2.2' }
|
||||
s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS and Mac.'
|
||||
s.source_files = 'SSZipArchive.*', 'minizip/*.{h,c}'
|
||||
s.library = 'z'
|
||||
s.preserve_paths = ['Tests', '.gitignore']
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
||||
# Maintain the dir structure for headers
|
||||
def s.copy_header_mapping(from)
|
||||
from
|
||||
end
|
||||
s.name = 'SSZipArchive'
|
||||
s.version = '0.4.0'
|
||||
s.summary = 'Utility class for zipping and unzipping files on iOS and Mac.'
|
||||
s.description = 'SSZipArchive is a simple utility class for zipping and unzipping files on iOS and Mac.'
|
||||
s.homepage = 'https://github.com/soffes/ssziparchive'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE.txt' }
|
||||
s.author = { 'Sam Soffes' => 'sam@soff.es' }
|
||||
s.source = { :git => 'https://github.com/soffes/ssziparchive.git', :tag => "v#{s.version}" }
|
||||
s.ios.deployment_target = '4.0'
|
||||
s.osx.deployment_target = '10.6'
|
||||
s.source_files = 'SSZipArchive/*', 'SSZipArchive/minizip/*'
|
||||
s.public_header_files = 'SSZipArchive/*.h'
|
||||
s.library = 'z'
|
||||
s.requires_arc = true
|
||||
end
|
||||
|
||||
43
SSZipArchive/Common.h
Normal file
43
SSZipArchive/Common.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef SSZipCommon
|
||||
#define SSZipCommon
|
||||
|
||||
/* tm_unz contain date/time info */
|
||||
typedef struct tm_unz_s
|
||||
{
|
||||
unsigned int tm_sec; /* seconds after the minute - [0,59] */
|
||||
unsigned int tm_min; /* minutes after the hour - [0,59] */
|
||||
unsigned int tm_hour; /* hours since midnight - [0,23] */
|
||||
unsigned int tm_mday; /* day of the month - [1,31] */
|
||||
unsigned int tm_mon; /* months since January - [0,11] */
|
||||
unsigned int tm_year; /* years - [1980..2044] */
|
||||
} tm_unz;
|
||||
|
||||
typedef struct unz_file_info_s
|
||||
{
|
||||
unsigned long version; /* version made by 2 bytes */
|
||||
unsigned long version_needed; /* version needed to extract 2 bytes */
|
||||
unsigned long flag; /* general purpose bit flag 2 bytes */
|
||||
unsigned long compression_method; /* compression method 2 bytes */
|
||||
unsigned long dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||
unsigned long crc; /* crc-32 4 bytes */
|
||||
unsigned long compressed_size; /* compressed size 4 bytes */
|
||||
unsigned long uncompressed_size; /* uncompressed size 4 bytes */
|
||||
unsigned long size_filename; /* filename length 2 bytes */
|
||||
unsigned long size_file_extra; /* extra field length 2 bytes */
|
||||
unsigned long size_file_comment; /* file comment length 2 bytes */
|
||||
|
||||
unsigned long disk_num_start; /* disk number start 2 bytes */
|
||||
unsigned long internal_fa; /* internal file attributes 2 bytes */
|
||||
unsigned long external_fa; /* external file attributes 4 bytes */
|
||||
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info;
|
||||
|
||||
typedef struct unz_global_info_s
|
||||
{
|
||||
unsigned long number_entry; /* total number of entries in
|
||||
the central dir on this disk */
|
||||
unsigned long size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info;
|
||||
|
||||
#endif
|
||||
69
SSZipArchive/SSZipArchive.h
Normal file
69
SSZipArchive/SSZipArchive.h
Normal file
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// SSZipArchive.h
|
||||
// SSZipArchive
|
||||
//
|
||||
// Created by Sam Soffes on 7/21/10.
|
||||
// Copyright (c) Sam Soffes 2010-2015. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _SSZIPARCHIVE_H
|
||||
#define _SSZIPARCHIVE_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#include "Common.h"
|
||||
|
||||
@protocol SSZipArchiveDelegate;
|
||||
|
||||
@interface SSZipArchive : NSObject
|
||||
|
||||
// Unzip
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination;
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id<SSZipArchiveDelegate>)delegate;
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error;
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error delegate:(id<SSZipArchiveDelegate>)delegate;
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path
|
||||
toDestination:(NSString *)destination
|
||||
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler;
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path
|
||||
toDestination:(NSString *)destination
|
||||
overwrite:(BOOL)overwrite
|
||||
password:(NSString *)password
|
||||
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler;
|
||||
|
||||
// Zip
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)filenames;
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath;
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory;
|
||||
|
||||
- (instancetype)initWithPath:(NSString *)path;
|
||||
@property (NS_NONATOMIC_IOSONLY, readonly) BOOL open;
|
||||
- (BOOL)writeFile:(NSString *)path;
|
||||
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(NSString *)fileName;
|
||||
- (BOOL)writeData:(NSData *)data filename:(NSString *)filename;
|
||||
@property (NS_NONATOMIC_IOSONLY, readonly) BOOL close;
|
||||
|
||||
@end
|
||||
|
||||
@protocol SSZipArchiveDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
- (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo;
|
||||
- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath;
|
||||
|
||||
- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo;
|
||||
- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo;
|
||||
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo;
|
||||
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath;
|
||||
|
||||
- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total;
|
||||
- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* _SSZIPARCHIVE_H */
|
||||
674
SSZipArchive/SSZipArchive.m
Normal file
674
SSZipArchive/SSZipArchive.m
Normal file
@@ -0,0 +1,674 @@
|
||||
//
|
||||
// SSZipArchive.m
|
||||
// SSZipArchive
|
||||
//
|
||||
// Created by Sam Soffes on 7/21/10.
|
||||
// Copyright (c) Sam Soffes 2010-2015. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SSZipArchive.h"
|
||||
#include "unzip.h"
|
||||
#include "zip.h"
|
||||
#import "zlib.h"
|
||||
#import "zconf.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define CHUNK 16384
|
||||
|
||||
@interface SSZipArchive ()
|
||||
+ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime;
|
||||
@end
|
||||
|
||||
@implementation SSZipArchive
|
||||
{
|
||||
NSString *_path;
|
||||
NSString *_filename;
|
||||
zipFile _zip;
|
||||
}
|
||||
|
||||
#pragma mark - Unzipping
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination
|
||||
{
|
||||
return [self unzipFileAtPath:path toDestination:destination delegate:nil];
|
||||
}
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error
|
||||
{
|
||||
return [self unzipFileAtPath:path toDestination:destination overwrite:overwrite password:password error:error delegate:nil progressHandler:nil completionHandler:nil];
|
||||
}
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id<SSZipArchiveDelegate>)delegate
|
||||
{
|
||||
return [self unzipFileAtPath:path toDestination:destination overwrite:YES password:nil error:nil delegate:delegate progressHandler:nil completionHandler:nil];
|
||||
}
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError **)error delegate:(id<SSZipArchiveDelegate>)delegate
|
||||
{
|
||||
return [self unzipFileAtPath:path toDestination:destination overwrite:overwrite password:password error:error delegate:delegate progressHandler:nil completionHandler:nil];
|
||||
}
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path
|
||||
toDestination:(NSString *)destination
|
||||
overwrite:(BOOL)overwrite
|
||||
password:(NSString *)password
|
||||
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler
|
||||
{
|
||||
return [self unzipFileAtPath:path toDestination:destination overwrite:overwrite password:password error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler];
|
||||
}
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path
|
||||
toDestination:(NSString *)destination
|
||||
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler
|
||||
{
|
||||
return [self unzipFileAtPath:path toDestination:destination overwrite:YES password:nil error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler];
|
||||
}
|
||||
|
||||
+ (BOOL)unzipFileAtPath:(NSString *)path
|
||||
toDestination:(NSString *)destination
|
||||
overwrite:(BOOL)overwrite
|
||||
password:(NSString *)password
|
||||
error:(NSError **)error
|
||||
delegate:(id<SSZipArchiveDelegate>)delegate
|
||||
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
|
||||
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler
|
||||
{
|
||||
// Begin opening
|
||||
zipFile zip = unzOpen((const char*)[path UTF8String]);
|
||||
if (zip == NULL)
|
||||
{
|
||||
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open zip file"};
|
||||
NSError *err = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-1 userInfo:userInfo];
|
||||
if (error)
|
||||
{
|
||||
*error = err;
|
||||
}
|
||||
if (completionHandler)
|
||||
{
|
||||
completionHandler(nil, NO, err);
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSDictionary * fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];
|
||||
unsigned long long fileSize = [fileAttributes[NSFileSize] unsignedLongLongValue];
|
||||
unsigned long long currentPosition = 0;
|
||||
|
||||
unz_global_info globalInfo = {0ul, 0ul};
|
||||
unzGetGlobalInfo(zip, &globalInfo);
|
||||
|
||||
// Begin unzipping
|
||||
if (unzGoToFirstFile(zip) != UNZ_OK)
|
||||
{
|
||||
NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open first file in zip file"};
|
||||
NSError *err = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:-2 userInfo:userInfo];
|
||||
if (error)
|
||||
{
|
||||
*error = err;
|
||||
}
|
||||
if (completionHandler)
|
||||
{
|
||||
completionHandler(nil, NO, err);
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL success = YES;
|
||||
BOOL canceled = NO;
|
||||
int ret = 0;
|
||||
unsigned char buffer[4096] = {0};
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSMutableSet *directoriesModificationDates = [[NSMutableSet alloc] init];
|
||||
|
||||
// Message delegate
|
||||
if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipArchiveAtPath:zipInfo:)]) {
|
||||
[delegate zipArchiveWillUnzipArchiveAtPath:path zipInfo:globalInfo];
|
||||
}
|
||||
if ([delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) {
|
||||
[delegate zipArchiveProgressEvent:(NSInteger)currentPosition total:(NSInteger)fileSize];
|
||||
}
|
||||
|
||||
NSInteger currentFileNumber = 0;
|
||||
do {
|
||||
@autoreleasepool {
|
||||
if ([password length] == 0) {
|
||||
ret = unzOpenCurrentFile(zip);
|
||||
} else {
|
||||
ret = unzOpenCurrentFilePassword(zip, [password cStringUsingEncoding:NSASCIIStringEncoding]);
|
||||
}
|
||||
|
||||
if (ret != UNZ_OK) {
|
||||
success = NO;
|
||||
break;
|
||||
}
|
||||
|
||||
// Reading data and write to file
|
||||
unz_file_info fileInfo;
|
||||
memset(&fileInfo, 0, sizeof(unz_file_info));
|
||||
|
||||
ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0);
|
||||
if (ret != UNZ_OK) {
|
||||
success = NO;
|
||||
unzCloseCurrentFile(zip);
|
||||
break;
|
||||
}
|
||||
|
||||
currentPosition += fileInfo.compressed_size;
|
||||
|
||||
// Message delegate
|
||||
if ([delegate respondsToSelector:@selector(zipArchiveShouldUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) {
|
||||
if (![delegate zipArchiveShouldUnzipFileAtIndex:currentFileNumber
|
||||
totalFiles:(NSInteger)globalInfo.number_entry
|
||||
archivePath:path fileInfo:fileInfo]) {
|
||||
success = NO;
|
||||
canceled = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) {
|
||||
[delegate zipArchiveWillUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry
|
||||
archivePath:path fileInfo:fileInfo];
|
||||
}
|
||||
if ([delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) {
|
||||
[delegate zipArchiveProgressEvent:(NSInteger)currentPosition total:(NSInteger)fileSize];
|
||||
}
|
||||
|
||||
char *filename = (char *)malloc(fileInfo.size_filename + 1);
|
||||
unzGetCurrentFileInfo(zip, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0);
|
||||
filename[fileInfo.size_filename] = '\0';
|
||||
|
||||
//
|
||||
// Determine whether this is a symbolic link:
|
||||
// - File is stored with 'version made by' value of UNIX (3),
|
||||
// as per http://www.pkware.com/documents/casestudies/APPNOTE.TXT
|
||||
// in the upper byte of the version field.
|
||||
// - BSD4.4 st_mode constants are stored in the high 16 bits of the
|
||||
// external file attributes (defacto standard, verified against libarchive)
|
||||
//
|
||||
// The original constants can be found here:
|
||||
// http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/include/sys/stat.h
|
||||
//
|
||||
const uLong ZipUNIXVersion = 3;
|
||||
const uLong BSD_SFMT = 0170000;
|
||||
const uLong BSD_IFLNK = 0120000;
|
||||
|
||||
BOOL fileIsSymbolicLink = NO;
|
||||
if (((fileInfo.version >> 8) == ZipUNIXVersion) && BSD_IFLNK == (BSD_SFMT & (fileInfo.external_fa >> 16))) {
|
||||
fileIsSymbolicLink = NO;
|
||||
}
|
||||
|
||||
// Check if it contains directory
|
||||
NSString *strPath = @(filename);
|
||||
BOOL isDirectory = NO;
|
||||
if (filename[fileInfo.size_filename-1] == '/' || filename[fileInfo.size_filename-1] == '\\') {
|
||||
isDirectory = YES;
|
||||
}
|
||||
free(filename);
|
||||
|
||||
// Contains a path
|
||||
if ([strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location != NSNotFound) {
|
||||
strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"];
|
||||
}
|
||||
|
||||
NSString *fullPath = [destination stringByAppendingPathComponent:strPath];
|
||||
NSError *err = nil;
|
||||
NSDate *modDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate];
|
||||
NSDictionary *directoryAttr = @{NSFileCreationDate: modDate, NSFileModificationDate: modDate};
|
||||
|
||||
if (isDirectory) {
|
||||
[fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err];
|
||||
} else {
|
||||
[fileManager createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:directoryAttr error:&err];
|
||||
}
|
||||
if (nil != err) {
|
||||
NSLog(@"[SSZipArchive] Error: %@", err.localizedDescription);
|
||||
}
|
||||
|
||||
if(!fileIsSymbolicLink)
|
||||
[directoriesModificationDates addObject: @{@"path": fullPath, @"modDate": modDate}];
|
||||
|
||||
if ([fileManager fileExistsAtPath:fullPath] && !isDirectory && !overwrite) {
|
||||
unzCloseCurrentFile(zip);
|
||||
ret = unzGoToNextFile(zip);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!fileIsSymbolicLink) {
|
||||
FILE *fp = fopen((const char*)[fullPath UTF8String], "wb");
|
||||
while (fp) {
|
||||
int readBytes = unzReadCurrentFile(zip, buffer, 4096);
|
||||
|
||||
if (readBytes > 0) {
|
||||
fwrite(buffer, readBytes, 1, fp );
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fp) {
|
||||
if ([[[fullPath pathExtension] lowercaseString] isEqualToString:@"zip"]) {
|
||||
NSLog(@"Unzipping nested .zip file: %@", [fullPath lastPathComponent]);
|
||||
if ([self unzipFileAtPath:fullPath toDestination:[fullPath stringByDeletingLastPathComponent] overwrite:overwrite password:password error:nil delegate:nil]) {
|
||||
[[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil];
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
// Set the original datetime property
|
||||
if (fileInfo.dosDate != 0) {
|
||||
NSDate *orgDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate];
|
||||
NSDictionary *attr = @{NSFileModificationDate: orgDate};
|
||||
|
||||
if (attr) {
|
||||
if ([fileManager setAttributes:attr ofItemAtPath:fullPath error:nil] == NO) {
|
||||
// Can't set attributes
|
||||
NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting modification date");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the original permissions on the file
|
||||
uLong permissions = fileInfo.external_fa >> 16;
|
||||
if (permissions != 0) {
|
||||
// Store it into a NSNumber
|
||||
NSNumber *permissionsValue = @(permissions);
|
||||
|
||||
// Retrieve any existing attributes
|
||||
NSMutableDictionary *attrs = [[NSMutableDictionary alloc] initWithDictionary:[fileManager attributesOfItemAtPath:fullPath error:nil]];
|
||||
|
||||
// Set the value in the attributes dict
|
||||
attrs[NSFilePosixPermissions] = permissionsValue;
|
||||
|
||||
// Update attributes
|
||||
if ([fileManager setAttributes:attrs ofItemAtPath:fullPath error:nil] == NO) {
|
||||
// Unable to set the permissions attribute
|
||||
NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting permissions");
|
||||
}
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[attrs release];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assemble the path for the symbolic link
|
||||
NSMutableString* destinationPath = [NSMutableString string];
|
||||
int bytesRead = 0;
|
||||
while((bytesRead = unzReadCurrentFile(zip, buffer, 4096)) > 0)
|
||||
{
|
||||
buffer[bytesRead] = (int)0;
|
||||
[destinationPath appendString:@((const char*)buffer)];
|
||||
}
|
||||
|
||||
// Create the symbolic link (making sure it stays relative if it was relative before)
|
||||
int symlinkError = symlink([destinationPath cStringUsingEncoding:NSUTF8StringEncoding],
|
||||
[fullPath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
|
||||
if(symlinkError != 0)
|
||||
{
|
||||
NSLog(@"Failed to create symbolic link at \"%@\" to \"%@\". symlink() error code: %d", fullPath, destinationPath, errno);
|
||||
}
|
||||
}
|
||||
|
||||
unzCloseCurrentFile( zip );
|
||||
ret = unzGoToNextFile( zip );
|
||||
|
||||
// Message delegate
|
||||
if ([delegate respondsToSelector:@selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) {
|
||||
[delegate zipArchiveDidUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry
|
||||
archivePath:path fileInfo:fileInfo];
|
||||
} else if ([delegate respondsToSelector: @selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:unzippedFilePath:)]) {
|
||||
[delegate zipArchiveDidUnzipFileAtIndex: currentFileNumber totalFiles: (NSInteger)globalInfo.number_entry
|
||||
archivePath:path unzippedFilePath: fullPath];
|
||||
}
|
||||
|
||||
currentFileNumber++;
|
||||
if (progressHandler)
|
||||
{
|
||||
progressHandler(strPath, fileInfo, currentFileNumber, globalInfo.number_entry);
|
||||
}
|
||||
}
|
||||
} while(ret == UNZ_OK && ret != UNZ_END_OF_LIST_OF_FILE);
|
||||
|
||||
// Close
|
||||
unzClose(zip);
|
||||
|
||||
// The process of decompressing the .zip archive causes the modification times on the folders
|
||||
// to be set to the present time. So, when we are done, they need to be explicitly set.
|
||||
// set the modification date on all of the directories.
|
||||
NSError * err = nil;
|
||||
for (NSDictionary * d in directoriesModificationDates) {
|
||||
if (![[NSFileManager defaultManager] setAttributes:@{NSFileModificationDate: d[@"modDate"]} ofItemAtPath:d[@"path"] error:&err]) {
|
||||
NSLog(@"[SSZipArchive] Set attributes failed for directory: %@.", d[@"path"]);
|
||||
}
|
||||
if (err) {
|
||||
NSLog(@"[SSZipArchive] Error setting directory file modification date attribute: %@",err.localizedDescription);
|
||||
}
|
||||
}
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[directoriesModificationDates release];
|
||||
#endif
|
||||
|
||||
// Message delegate
|
||||
if (success && [delegate respondsToSelector:@selector(zipArchiveDidUnzipArchiveAtPath:zipInfo:unzippedPath:)]) {
|
||||
[delegate zipArchiveDidUnzipArchiveAtPath:path zipInfo:globalInfo unzippedPath:destination];
|
||||
}
|
||||
// final progress event = 100%
|
||||
if (!canceled && [delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) {
|
||||
[delegate zipArchiveProgressEvent:fileSize total:fileSize];
|
||||
}
|
||||
|
||||
if (completionHandler)
|
||||
{
|
||||
completionHandler(path, YES, nil);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
#pragma mark - Zipping
|
||||
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths
|
||||
{
|
||||
BOOL success = NO;
|
||||
SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path];
|
||||
if ([zipArchive open]) {
|
||||
for (NSString *filePath in paths) {
|
||||
[zipArchive writeFile:filePath];
|
||||
}
|
||||
success = [zipArchive close];
|
||||
}
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[zipArchive release];
|
||||
#endif
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath {
|
||||
return [self createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:NO];
|
||||
}
|
||||
|
||||
|
||||
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory {
|
||||
BOOL success = NO;
|
||||
|
||||
NSFileManager *fileManager = nil;
|
||||
SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path];
|
||||
|
||||
if ([zipArchive open]) {
|
||||
// use a local filemanager (queue/thread compatibility)
|
||||
fileManager = [[NSFileManager alloc] init];
|
||||
NSDirectoryEnumerator *dirEnumerator = [fileManager enumeratorAtPath:directoryPath];
|
||||
NSString *fileName;
|
||||
while ((fileName = [dirEnumerator nextObject])) {
|
||||
BOOL isDir;
|
||||
NSString *fullFilePath = [directoryPath stringByAppendingPathComponent:fileName];
|
||||
[fileManager fileExistsAtPath:fullFilePath isDirectory:&isDir];
|
||||
if (!isDir) {
|
||||
if (keepParentDirectory)
|
||||
{
|
||||
fileName = [[directoryPath lastPathComponent] stringByAppendingPathComponent:fileName];
|
||||
}
|
||||
[zipArchive writeFileAtPath:fullFilePath withFileName:fileName];
|
||||
}
|
||||
else
|
||||
{
|
||||
if([[NSFileManager defaultManager] subpathsOfDirectoryAtPath:fullFilePath error:nil].count == 0)
|
||||
{
|
||||
NSString *tempName = [fullFilePath stringByAppendingPathComponent:@".DS_Store"];
|
||||
[@"" writeToFile:tempName atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
||||
[zipArchive writeFileAtPath:tempName withFileName:[fileName stringByAppendingPathComponent:@".DS_Store"]];
|
||||
[[NSFileManager defaultManager] removeItemAtPath:tempName error:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
success = [zipArchive close];
|
||||
}
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[fileManager release];
|
||||
[zipArchive release];
|
||||
#endif
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
- (instancetype)initWithPath:(NSString *)path
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_path = [path copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
- (void)dealloc
|
||||
{
|
||||
[_path release];
|
||||
[super dealloc];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
- (BOOL)open
|
||||
{
|
||||
NSAssert((_zip == NULL), @"Attempting open an archive which is already open");
|
||||
_zip = zipOpen([_path UTF8String], APPEND_STATUS_CREATE);
|
||||
return (NULL != _zip);
|
||||
}
|
||||
|
||||
|
||||
- (void)zipInfo:(zip_fileinfo*)zipInfo setDate:(NSDate*)date
|
||||
{
|
||||
NSCalendar *currentCalendar = [NSCalendar currentCalendar];
|
||||
#if defined(__IPHONE_8_0) || defined(__MAC_10_10)
|
||||
uint flags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
|
||||
#else
|
||||
uint flags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
|
||||
#endif
|
||||
NSDateComponents *components = [currentCalendar components:flags fromDate:date];
|
||||
zipInfo->tmz_date.tm_sec = (unsigned int)components.second;
|
||||
zipInfo->tmz_date.tm_min = (unsigned int)components.minute;
|
||||
zipInfo->tmz_date.tm_hour = (unsigned int)components.hour;
|
||||
zipInfo->tmz_date.tm_mday = (unsigned int)components.day;
|
||||
zipInfo->tmz_date.tm_mon = (unsigned int)components.month - 1;
|
||||
zipInfo->tmz_date.tm_year = (unsigned int)components.year;
|
||||
}
|
||||
|
||||
- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName
|
||||
{
|
||||
NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened");
|
||||
|
||||
zip_fileinfo zipInfo = {{0}};
|
||||
|
||||
NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error: nil];
|
||||
if( attr )
|
||||
{
|
||||
NSDate *fileDate = (NSDate *)attr[NSFileModificationDate];
|
||||
if( fileDate )
|
||||
{
|
||||
[self zipInfo:&zipInfo setDate: fileDate ];
|
||||
}
|
||||
|
||||
// Write permissions into the external attributes, for details on this see here: http://unix.stackexchange.com/a/14727
|
||||
// Get the permissions value from the files attributes
|
||||
NSNumber *permissionsValue = (NSNumber *)attr[NSFilePosixPermissions];
|
||||
if (permissionsValue) {
|
||||
// Get the short value for the permissions
|
||||
short permissionsShort = permissionsValue.shortValue;
|
||||
|
||||
// Convert this into an octal by adding 010000, 010000 being the flag for a regular file
|
||||
NSInteger permissionsOctal = 0100000 + permissionsShort;
|
||||
|
||||
// Convert this into a long value
|
||||
uLong permissionsLong = @(permissionsOctal).unsignedLongValue;
|
||||
|
||||
// Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte
|
||||
zipInfo.external_fa = permissionsLong << 16L;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int len = 0;
|
||||
zipOpenNewFileInZip(_zip, [[folderName stringByAppendingString:@"/"] UTF8String], &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_NO_COMPRESSION);
|
||||
zipWriteInFileInZip(_zip, &len, 0);
|
||||
zipCloseFileInZip(_zip);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)writeFile:(NSString *)path
|
||||
{
|
||||
return [self writeFileAtPath:path withFileName:nil];
|
||||
}
|
||||
|
||||
// supports writing files with logical folder/directory structure
|
||||
// *path* is the absolute path of the file that will be compressed
|
||||
// *fileName* is the relative name of the file how it is stored within the zip e.g. /folder/subfolder/text1.txt
|
||||
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(NSString *)fileName
|
||||
{
|
||||
NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened");
|
||||
|
||||
FILE *input = fopen([path UTF8String], "r");
|
||||
if (NULL == input) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
const char *afileName;
|
||||
if (!fileName) {
|
||||
afileName = [path.lastPathComponent UTF8String];
|
||||
}
|
||||
else {
|
||||
afileName = [fileName UTF8String];
|
||||
}
|
||||
|
||||
zip_fileinfo zipInfo = {{0}};
|
||||
|
||||
NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error: nil];
|
||||
if( attr )
|
||||
{
|
||||
NSDate *fileDate = (NSDate *)attr[NSFileModificationDate];
|
||||
if( fileDate )
|
||||
{
|
||||
[self zipInfo:&zipInfo setDate: fileDate ];
|
||||
}
|
||||
|
||||
// Write permissions into the external attributes, for details on this see here: http://unix.stackexchange.com/a/14727
|
||||
// Get the permissions value from the files attributes
|
||||
NSNumber *permissionsValue = (NSNumber *)attr[NSFilePosixPermissions];
|
||||
if (permissionsValue) {
|
||||
// Get the short value for the permissions
|
||||
short permissionsShort = permissionsValue.shortValue;
|
||||
|
||||
// Convert this into an octal by adding 010000, 010000 being the flag for a regular file
|
||||
NSInteger permissionsOctal = 0100000 + permissionsShort;
|
||||
|
||||
// Convert this into a long value
|
||||
uLong permissionsLong = @(permissionsOctal).unsignedLongValue;
|
||||
|
||||
// Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte
|
||||
zipInfo.external_fa = permissionsLong << 16L;
|
||||
}
|
||||
}
|
||||
|
||||
zipOpenNewFileInZip(_zip, afileName, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
||||
|
||||
void *buffer = malloc(CHUNK);
|
||||
unsigned int len = 0;
|
||||
|
||||
while (!feof(input))
|
||||
{
|
||||
len = (unsigned int) fread(buffer, 1, CHUNK, input);
|
||||
zipWriteInFileInZip(_zip, buffer, len);
|
||||
}
|
||||
|
||||
zipCloseFileInZip(_zip);
|
||||
free(buffer);
|
||||
fclose(input);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)writeData:(NSData *)data filename:(NSString *)filename
|
||||
{
|
||||
if (!_zip) {
|
||||
return NO;
|
||||
}
|
||||
if (!data) {
|
||||
return NO;
|
||||
}
|
||||
zip_fileinfo zipInfo = {{0,0,0,0,0,0},0,0,0};
|
||||
[self zipInfo:&zipInfo setDate:[NSDate date]];
|
||||
|
||||
zipOpenNewFileInZip(_zip, [filename UTF8String], &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
|
||||
|
||||
zipWriteInFileInZip(_zip, data.bytes, (unsigned int)data.length);
|
||||
|
||||
zipCloseFileInZip(_zip);
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)close
|
||||
{
|
||||
NSAssert((_zip != NULL), @"[SSZipArchive] Attempting to close an archive which was never opened");
|
||||
zipClose(_zip, NULL);
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
// Format from http://newsgroups.derkeiler.com/Archive/Comp/comp.os.msdos.programmer/2009-04/msg00060.html
|
||||
// Two consecutive words, or a longword, YYYYYYYMMMMDDDDD hhhhhmmmmmmsssss
|
||||
// YYYYYYY is years from 1980 = 0
|
||||
// sssss is (seconds/2).
|
||||
//
|
||||
// 3658 = 0011 0110 0101 1000 = 0011011 0010 11000 = 27 2 24 = 2007-02-24
|
||||
// 7423 = 0111 0100 0010 0011 - 01110 100001 00011 = 14 33 2 = 14:33:06
|
||||
+ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime
|
||||
{
|
||||
static const UInt32 kYearMask = 0xFE000000;
|
||||
static const UInt32 kMonthMask = 0x1E00000;
|
||||
static const UInt32 kDayMask = 0x1F0000;
|
||||
static const UInt32 kHourMask = 0xF800;
|
||||
static const UInt32 kMinuteMask = 0x7E0;
|
||||
static const UInt32 kSecondMask = 0x1F;
|
||||
|
||||
static NSCalendar *gregorian;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
#if defined(__IPHONE_8_0) || defined(__MAC_10_10)
|
||||
gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
|
||||
#else
|
||||
gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
|
||||
#endif
|
||||
});
|
||||
|
||||
NSDateComponents *components = [[NSDateComponents alloc] init];
|
||||
|
||||
NSAssert(0xFFFFFFFF == (kYearMask | kMonthMask | kDayMask | kHourMask | kMinuteMask | kSecondMask), @"[SSZipArchive] MSDOS date masks don't add up");
|
||||
|
||||
[components setYear:1980 + ((msdosDateTime & kYearMask) >> 25)];
|
||||
[components setMonth:(msdosDateTime & kMonthMask) >> 21];
|
||||
[components setDay:(msdosDateTime & kDayMask) >> 16];
|
||||
[components setHour:(msdosDateTime & kHourMask) >> 11];
|
||||
[components setMinute:(msdosDateTime & kMinuteMask) >> 5];
|
||||
[components setSecond:(msdosDateTime & kSecondMask) * 2];
|
||||
|
||||
NSDate *date = [NSDate dateWithTimeInterval:0 sinceDate:[gregorian dateFromComponents:components]];
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
[components release];
|
||||
#endif
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -192,9 +192,8 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
|
||||
}
|
||||
ret = 0;
|
||||
|
||||
if(fseeko64((FILE *)stream, offset, fseek_origin) != 0)
|
||||
if(fseeko64((FILE *)stream, (long)offset, fseek_origin) != 0)
|
||||
ret = -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1038,7 +1038,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||
/* ZIP64 extra fields */
|
||||
if (headerId == 0x0001)
|
||||
{
|
||||
uLong uL;
|
||||
uLong uLZip64;
|
||||
|
||||
if(file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1)
|
||||
{
|
||||
@@ -1062,7 +1062,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||
if(file_info.disk_num_start == (unsigned long)-1)
|
||||
{
|
||||
/* Disk Start Number */
|
||||
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
|
||||
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uLZip64) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
}
|
||||
|
||||
@@ -1514,6 +1514,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||
pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
|
||||
pfile_in_zip_read_info->pos_local_extrafield=0;
|
||||
pfile_in_zip_read_info->raw=raw;
|
||||
pfile_in_zip_read_info->byte_before_the_zipfile = 0;
|
||||
|
||||
if (pfile_in_zip_read_info->read_buffer==NULL)
|
||||
{
|
||||
@@ -1554,9 +1555,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||
pfile_in_zip_read_info->compression_method = s->cur_file_info.compression_method;
|
||||
pfile_in_zip_read_info->filestream=s->filestream;
|
||||
pfile_in_zip_read_info->z_filefunc=s->z_filefunc;
|
||||
#ifndef __clang_analyzer__
|
||||
pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
|
||||
#endif
|
||||
|
||||
pfile_in_zip_read_info->stream.total_out = 0;
|
||||
|
||||
@@ -70,6 +70,7 @@ typedef unzFile__ *unzFile;
|
||||
typedef voidp unzFile;
|
||||
#endif
|
||||
|
||||
#include "../Common.h"
|
||||
|
||||
#define UNZ_OK (0)
|
||||
#define UNZ_END_OF_LIST_OF_FILE (-100)
|
||||
@@ -80,17 +81,6 @@ typedef voidp unzFile;
|
||||
#define UNZ_INTERNALERROR (-104)
|
||||
#define UNZ_CRCERROR (-105)
|
||||
|
||||
/* tm_unz contain date/time info */
|
||||
typedef struct tm_unz_s
|
||||
{
|
||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||
uInt tm_mday; /* day of the month - [1,31] */
|
||||
uInt tm_mon; /* months since January - [0,11] */
|
||||
uInt tm_year; /* years - [1980..2044] */
|
||||
} tm_unz;
|
||||
|
||||
/* unz_global_info structure contain global data about the ZIPfile
|
||||
These data comes from the end of central dir */
|
||||
typedef struct unz_global_info64_s
|
||||
@@ -100,13 +90,6 @@ typedef struct unz_global_info64_s
|
||||
uLong size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info64;
|
||||
|
||||
typedef struct unz_global_info_s
|
||||
{
|
||||
uLong number_entry; /* total number of entries in
|
||||
the central dir on this disk */
|
||||
uLong size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info;
|
||||
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_info64_s
|
||||
{
|
||||
@@ -129,27 +112,6 @@ typedef struct unz_file_info64_s
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info64;
|
||||
|
||||
typedef struct unz_file_info_s
|
||||
{
|
||||
uLong version; /* version made by 2 bytes */
|
||||
uLong version_needed; /* version needed to extract 2 bytes */
|
||||
uLong flag; /* general purpose bit flag 2 bytes */
|
||||
uLong compression_method; /* compression method 2 bytes */
|
||||
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||
uLong crc; /* crc-32 4 bytes */
|
||||
uLong compressed_size; /* compressed size 4 bytes */
|
||||
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||
uLong size_filename; /* filename length 2 bytes */
|
||||
uLong size_file_extra; /* extra field length 2 bytes */
|
||||
uLong size_file_comment; /* file comment length 2 bytes */
|
||||
|
||||
uLong disk_num_start; /* disk number start 2 bytes */
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info;
|
||||
|
||||
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
||||
const char* fileName2,
|
||||
int iCaseSensitivity));
|
||||
8
SwiftExample/Podfile
Normal file
8
SwiftExample/Podfile
Normal file
@@ -0,0 +1,8 @@
|
||||
source 'https://github.com/CocoaPods/Specs.git'
|
||||
|
||||
# inhibit_all_warnings!
|
||||
use_frameworks!
|
||||
|
||||
target 'SwiftExample' do
|
||||
pod 'SSZipArchive', :path => '..'
|
||||
end
|
||||
14
SwiftExample/Podfile.lock
Normal file
14
SwiftExample/Podfile.lock
Normal file
@@ -0,0 +1,14 @@
|
||||
PODS:
|
||||
- SSZipArchive (0.3.2)
|
||||
|
||||
DEPENDENCIES:
|
||||
- SSZipArchive (from `..`)
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
SSZipArchive:
|
||||
:path: ".."
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
SSZipArchive: 0f61dba1ab479a636f095aaf75a6cdafb5ff9d0c
|
||||
|
||||
COCOAPODS: 0.39.0
|
||||
528
SwiftExample/SwiftExample.xcodeproj/project.pbxproj
Normal file
528
SwiftExample/SwiftExample.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,528 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
5914648EC4509E192D31CA42 /* Pods_SwiftExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E81180168B01E0210FE1E3F /* Pods_SwiftExample.framework */; };
|
||||
8DFE190D1BDA74F800709011 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE190C1BDA74F800709011 /* AppDelegate.swift */; };
|
||||
8DFE190F1BDA74F800709011 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE190E1BDA74F800709011 /* ViewController.swift */; };
|
||||
8DFE19121BDA74F800709011 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19101BDA74F800709011 /* Main.storyboard */; };
|
||||
8DFE19141BDA74F800709011 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19131BDA74F800709011 /* Assets.xcassets */; };
|
||||
8DFE19171BDA74F800709011 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19151BDA74F800709011 /* LaunchScreen.storyboard */; };
|
||||
8DFE19221BDA74F800709011 /* SwiftExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19211BDA74F800709011 /* SwiftExampleTests.swift */; };
|
||||
8DFE19421BDA7D8D00709011 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = 8DFE19391BDA7D8C00709011 /* mztools.c */; };
|
||||
8DFE19471BDA82EA00709011 /* Sample Data in Resources */ = {isa = PBXBuildFile; fileRef = 8DFE19461BDA82EA00709011 /* Sample Data */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
8DFE191E1BDA74F800709011 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 8DFE19011BDA74F800709011 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 8DFE19081BDA74F800709011;
|
||||
remoteInfo = SwiftExample;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
8DFE19091BDA74F800709011 /* SwiftExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8DFE190C1BDA74F800709011 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
8DFE190E1BDA74F800709011 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
8DFE19111BDA74F800709011 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
8DFE19131BDA74F800709011 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
8DFE19161BDA74F800709011 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
8DFE19181BDA74F800709011 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8DFE191D1BDA74F800709011 /* SwiftExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8DFE19211BDA74F800709011 /* SwiftExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftExampleTests.swift; sourceTree = "<group>"; };
|
||||
8DFE19231BDA74F800709011 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8DFE19341BDA7D8C00709011 /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; };
|
||||
8DFE19361BDA7D8C00709011 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt.h; sourceTree = "<group>"; };
|
||||
8DFE19371BDA7D8C00709011 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ioapi.c; sourceTree = "<group>"; };
|
||||
8DFE19381BDA7D8C00709011 /* ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ioapi.h; sourceTree = "<group>"; };
|
||||
8DFE19391BDA7D8C00709011 /* mztools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mztools.c; sourceTree = "<group>"; };
|
||||
8DFE193A1BDA7D8C00709011 /* mztools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mztools.h; sourceTree = "<group>"; };
|
||||
8DFE193B1BDA7D8C00709011 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unzip.c; sourceTree = "<group>"; };
|
||||
8DFE193C1BDA7D8C00709011 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = "<group>"; };
|
||||
8DFE193D1BDA7D8C00709011 /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip.c; sourceTree = "<group>"; };
|
||||
8DFE193E1BDA7D8C00709011 /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zip.h; sourceTree = "<group>"; };
|
||||
8DFE193F1BDA7D8C00709011 /* SSZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSZipArchive.h; sourceTree = "<group>"; };
|
||||
8DFE19401BDA7D8D00709011 /* SSZipArchive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSZipArchive.m; sourceTree = "<group>"; };
|
||||
8DFE19461BDA82EA00709011 /* Sample Data */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "Sample Data"; sourceTree = "<group>"; };
|
||||
9E81180168B01E0210FE1E3F /* Pods_SwiftExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftExample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EDFB736C117CB42411E221E3 /* Pods-SwiftExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.release.xcconfig"; sourceTree = "<group>"; };
|
||||
FA88DF2AF701AB45DE8B7EB5 /* Pods-SwiftExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
8DFE19061BDA74F800709011 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5914648EC4509E192D31CA42 /* Pods_SwiftExample.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8DFE191A1BDA74F800709011 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
1B67DA700507825BD99DCEA7 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9E81180168B01E0210FE1E3F /* Pods_SwiftExample.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE19001BDA74F800709011 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE19331BDA7D8C00709011 /* SSZipArchive */,
|
||||
8DFE190B1BDA74F800709011 /* SwiftExample */,
|
||||
8DFE19201BDA74F800709011 /* SwiftExampleTests */,
|
||||
8DFE190A1BDA74F800709011 /* Products */,
|
||||
F5943061786EAFF4CAE16D45 /* Pods */,
|
||||
1B67DA700507825BD99DCEA7 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE190A1BDA74F800709011 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE19091BDA74F800709011 /* SwiftExample.app */,
|
||||
8DFE191D1BDA74F800709011 /* SwiftExampleTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE190B1BDA74F800709011 /* SwiftExample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE190C1BDA74F800709011 /* AppDelegate.swift */,
|
||||
8DFE190E1BDA74F800709011 /* ViewController.swift */,
|
||||
8DFE19101BDA74F800709011 /* Main.storyboard */,
|
||||
8DFE19131BDA74F800709011 /* Assets.xcassets */,
|
||||
8DFE19151BDA74F800709011 /* LaunchScreen.storyboard */,
|
||||
8DFE19181BDA74F800709011 /* Info.plist */,
|
||||
8DFE19461BDA82EA00709011 /* Sample Data */,
|
||||
);
|
||||
path = SwiftExample;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE19201BDA74F800709011 /* SwiftExampleTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE19211BDA74F800709011 /* SwiftExampleTests.swift */,
|
||||
8DFE19231BDA74F800709011 /* Info.plist */,
|
||||
);
|
||||
path = SwiftExampleTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE19331BDA7D8C00709011 /* SSZipArchive */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE19341BDA7D8C00709011 /* Common.h */,
|
||||
8DFE193F1BDA7D8C00709011 /* SSZipArchive.h */,
|
||||
8DFE19401BDA7D8D00709011 /* SSZipArchive.m */,
|
||||
8DFE19351BDA7D8C00709011 /* minizip */,
|
||||
);
|
||||
name = SSZipArchive;
|
||||
path = ../SSZipArchive;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE19351BDA7D8C00709011 /* minizip */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DFE19361BDA7D8C00709011 /* crypt.h */,
|
||||
8DFE19371BDA7D8C00709011 /* ioapi.c */,
|
||||
8DFE19381BDA7D8C00709011 /* ioapi.h */,
|
||||
8DFE19391BDA7D8C00709011 /* mztools.c */,
|
||||
8DFE193A1BDA7D8C00709011 /* mztools.h */,
|
||||
8DFE193B1BDA7D8C00709011 /* unzip.c */,
|
||||
8DFE193C1BDA7D8C00709011 /* unzip.h */,
|
||||
8DFE193D1BDA7D8C00709011 /* zip.c */,
|
||||
8DFE193E1BDA7D8C00709011 /* zip.h */,
|
||||
);
|
||||
path = minizip;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F5943061786EAFF4CAE16D45 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FA88DF2AF701AB45DE8B7EB5 /* Pods-SwiftExample.debug.xcconfig */,
|
||||
EDFB736C117CB42411E221E3 /* Pods-SwiftExample.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8DFE19081BDA74F800709011 /* SwiftExample */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 8DFE19261BDA74F800709011 /* Build configuration list for PBXNativeTarget "SwiftExample" */;
|
||||
buildPhases = (
|
||||
E78B00A33CAF266DB67D6E49 /* Check Pods Manifest.lock */,
|
||||
8DFE19051BDA74F800709011 /* Sources */,
|
||||
8DFE19061BDA74F800709011 /* Frameworks */,
|
||||
8DFE19071BDA74F800709011 /* Resources */,
|
||||
AEFD7A965DD623210F3FCEAA /* Embed Pods Frameworks */,
|
||||
D85ACD9C6E611B2AC2024437 /* Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = SwiftExample;
|
||||
productName = SwiftExample;
|
||||
productReference = 8DFE19091BDA74F800709011 /* SwiftExample.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
8DFE191C1BDA74F800709011 /* SwiftExampleTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 8DFE19291BDA74F800709011 /* Build configuration list for PBXNativeTarget "SwiftExampleTests" */;
|
||||
buildPhases = (
|
||||
8DFE19191BDA74F800709011 /* Sources */,
|
||||
8DFE191A1BDA74F800709011 /* Frameworks */,
|
||||
8DFE191B1BDA74F800709011 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
8DFE191F1BDA74F800709011 /* PBXTargetDependency */,
|
||||
);
|
||||
name = SwiftExampleTests;
|
||||
productName = SwiftExampleTests;
|
||||
productReference = 8DFE191D1BDA74F800709011 /* SwiftExampleTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
8DFE19011BDA74F800709011 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0710;
|
||||
LastUpgradeCheck = 0710;
|
||||
TargetAttributes = {
|
||||
8DFE19081BDA74F800709011 = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
};
|
||||
8DFE191C1BDA74F800709011 = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
TestTargetID = 8DFE19081BDA74F800709011;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 8DFE19041BDA74F800709011 /* Build configuration list for PBXProject "SwiftExample" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 8DFE19001BDA74F800709011;
|
||||
productRefGroup = 8DFE190A1BDA74F800709011 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8DFE19081BDA74F800709011 /* SwiftExample */,
|
||||
8DFE191C1BDA74F800709011 /* SwiftExampleTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
8DFE19071BDA74F800709011 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DFE19171BDA74F800709011 /* LaunchScreen.storyboard in Resources */,
|
||||
8DFE19141BDA74F800709011 /* Assets.xcassets in Resources */,
|
||||
8DFE19121BDA74F800709011 /* Main.storyboard in Resources */,
|
||||
8DFE19471BDA82EA00709011 /* Sample Data in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8DFE191B1BDA74F800709011 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
AEFD7A965DD623210F3FCEAA /* Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Embed Pods Frameworks";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
D85ACD9C6E611B2AC2024437 /* Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Copy Pods Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SwiftExample/Pods-SwiftExample-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
E78B00A33CAF266DB67D6E49 /* Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Check Pods Manifest.lock";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8DFE19051BDA74F800709011 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DFE19421BDA7D8D00709011 /* mztools.c in Sources */,
|
||||
8DFE190F1BDA74F800709011 /* ViewController.swift in Sources */,
|
||||
8DFE190D1BDA74F800709011 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
8DFE19191BDA74F800709011 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8DFE19221BDA74F800709011 /* SwiftExampleTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
8DFE191F1BDA74F800709011 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 8DFE19081BDA74F800709011 /* SwiftExample */;
|
||||
targetProxy = 8DFE191E1BDA74F800709011 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
8DFE19101BDA74F800709011 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
8DFE19111BDA74F800709011 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8DFE19151BDA74F800709011 /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
8DFE19161BDA74F800709011 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
8DFE19241BDA74F800709011 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
8DFE19251BDA74F800709011 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
8DFE19271BDA74F800709011 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FA88DF2AF701AB45DE8B7EB5 /* Pods-SwiftExample.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = SwiftExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
8DFE19281BDA74F800709011 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = EDFB736C117CB42411E221E3 /* Pods-SwiftExample.release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
INFOPLIST_FILE = SwiftExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
8DFE192A1BDA74F800709011 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = SwiftExampleTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExampleTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
8DFE192B1BDA74F800709011 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
INFOPLIST_FILE = SwiftExampleTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.samsoffes.SwiftExampleTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
8DFE19041BDA74F800709011 /* Build configuration list for PBXProject "SwiftExample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
8DFE19241BDA74F800709011 /* Debug */,
|
||||
8DFE19251BDA74F800709011 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
8DFE19261BDA74F800709011 /* Build configuration list for PBXNativeTarget "SwiftExample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
8DFE19271BDA74F800709011 /* Debug */,
|
||||
8DFE19281BDA74F800709011 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
8DFE19291BDA74F800709011 /* Build configuration list for PBXNativeTarget "SwiftExampleTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
8DFE192A1BDA74F800709011 /* Debug */,
|
||||
8DFE192B1BDA74F800709011 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 8DFE19011BDA74F800709011 /* Project object */;
|
||||
}
|
||||
7
SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
SwiftExample/SwiftExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:SwiftExample.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
10
SwiftExample/SwiftExample.xcworkspace/contents.xcworkspacedata
generated
Normal file
10
SwiftExample/SwiftExample.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:SwiftExample.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
46
SwiftExample/SwiftExample/AppDelegate.swift
Normal file
46
SwiftExample/SwiftExample/AppDelegate.swift
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// AppDelegate.swift
|
||||
// SwiftExample
|
||||
//
|
||||
// Created by Sean Soper on 10/23/15.
|
||||
//
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
func applicationDidEnterBackground(application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(application: UIApplication) {
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
func applicationWillTerminate(application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
27
SwiftExample/SwiftExample/Base.lproj/LaunchScreen.storyboard
Normal file
27
SwiftExample/SwiftExample/Base.lproj/LaunchScreen.storyboard
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
83
SwiftExample/SwiftExample/Base.lproj/Main.storyboard
Normal file
83
SwiftExample/SwiftExample/Base.lproj/Main.storyboard
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="SwiftExample" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<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"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Uwd-kM-cdh">
|
||||
<rect key="frame" x="244" y="51" width="113" height="30"/>
|
||||
<animations/>
|
||||
<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" fixedFrame="YES" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XUJ-IR-RIS">
|
||||
<rect key="frame" x="235" y="89" width="131" height="30"/>
|
||||
<animations/>
|
||||
<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" fixedFrame="YES" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Lbq-oS-Rlj">
|
||||
<rect key="frame" x="281" y="214" width="39" height="30"/>
|
||||
<animations/>
|
||||
<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" fixedFrame="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="09F-6Q-slx" userLabel="File1">
|
||||
<rect key="frame" x="67" y="127" width="480" height="21"/>
|
||||
<animations/>
|
||||
<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" fixedFrame="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PSK-Jd-Mwc" userLabel="File2">
|
||||
<rect key="frame" x="67" y="156" width="480" height="21"/>
|
||||
<animations/>
|
||||
<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" fixedFrame="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pW5-rw-iqM" userLabel="File3">
|
||||
<rect key="frame" x="67" y="185" width="480" height="21"/>
|
||||
<animations/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="file1" destination="09F-6Q-slx" id="Rmp-Xl-xfc"/>
|
||||
<outlet property="file2" destination="PSK-Jd-Mwc" id="Fek-5n-1P2"/>
|
||||
<outlet property="file3" destination="pW5-rw-iqM" id="8cy-pX-Oa9"/>
|
||||
<outlet property="resetButton" destination="Lbq-oS-Rlj" id="NMW-xE-8bl"/>
|
||||
<outlet property="unzipButton" destination="XUJ-IR-RIS" id="mVz-FE-G7d"/>
|
||||
<outlet property="zipButton" destination="Uwd-kM-cdh" id="zCa-UM-3rx"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="565" y="412"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
47
SwiftExample/SwiftExample/Info.plist
Normal file
47
SwiftExample/SwiftExample/Info.plist
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,9 @@
|
||||
# China to ban ivory trade
|
||||
|
||||
**HONG KONG** — It could be the beginning of the end for the illicit trade in ivory.
|
||||
|
||||
Last month, on a state visit to Washington, Chinese President Xi Jinping promised to stop the commercial trade in ivory in his country but gave few details about the timing and extent of such a move.
|
||||
|
||||
Now, a senior U.S. government official says that the Chinese ban could be in place within a year or so, with very narrow exceptions, describing it as a “huge” deal.
|
||||
|
||||
Such a move, conservationists say, would be a major step toward ending the poaching crisis that is decimating Africa’s elephant herds.
|
||||
9
SwiftExample/SwiftExample/Sample Data/Kerry in Syria.md
Normal file
9
SwiftExample/SwiftExample/Sample Data/Kerry in Syria.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Kerry in Syria
|
||||
|
||||
**VIENNA** — The war raging in Syria took center stage for Secretary of State John F. Kerry on Friday as he kicked off a series of meetings with diplomats seeking common ground on a strategy to resolve the grinding conflict.
|
||||
|
||||
But the foreign ministers of the three countries meeting with Kerry — Russia, Saudi Arabia and NATO-member Turkey — carry sharply competing views on how to proceed.
|
||||
|
||||
Saudi Arabia and Turkey, the neighboring country that has been overwhelmed with Syrian refugees, agree with Washington that Syrian President Bashar Al-Assad should eventually leave power.
|
||||
|
||||
Moscow is one of Assad’s biggest backers, and in recent weeks has positioned its military in Syria and conducted heavy airstrikes that have allowed Assad’s forces to resume ground offensives. The Russian military intervention also has alarmed the Pentagon, which is leading a separate air campaign against the Islamic State.
|
||||
BIN
SwiftExample/SwiftExample/Sample Data/wapo twitter banner.png
Normal file
BIN
SwiftExample/SwiftExample/Sample Data/wapo twitter banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
120
SwiftExample/SwiftExample/ViewController.swift
Normal file
120
SwiftExample/SwiftExample/ViewController.swift
Normal file
@@ -0,0 +1,120 @@
|
||||
//
|
||||
// ViewController.swift
|
||||
// SwiftExample
|
||||
//
|
||||
// Created by Sean Soper on 10/23/15.
|
||||
//
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import SSZipArchive
|
||||
|
||||
class ViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var zipButton: UIButton!
|
||||
@IBOutlet weak var unzipButton: UIButton!
|
||||
@IBOutlet weak var resetButton: UIButton!
|
||||
|
||||
@IBOutlet weak var file1: UILabel!
|
||||
@IBOutlet weak var file2: UILabel!
|
||||
@IBOutlet weak var file3: UILabel!
|
||||
|
||||
var zipPath: String?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
// MARK: IBAction
|
||||
|
||||
@IBAction func zipPressed(_: UIButton) {
|
||||
let sampleDataPath = NSBundle.mainBundle().bundleURL.URLByAppendingPathComponent("Sample Data").path
|
||||
zipPath = tempZipPath()
|
||||
|
||||
let success = SSZipArchive.createZipFileAtPath(zipPath, withContentsOfDirectory: sampleDataPath)
|
||||
if success {
|
||||
unzipButton.enabled = true
|
||||
zipButton.enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func unzipPressed(_: UIButton) {
|
||||
guard let zipPath = self.zipPath else {
|
||||
return
|
||||
}
|
||||
|
||||
guard let unzipPath = tempUnzipPath() else {
|
||||
return
|
||||
}
|
||||
|
||||
let success = SSZipArchive.unzipFileAtPath(zipPath, toDestination: unzipPath)
|
||||
if !success {
|
||||
return
|
||||
}
|
||||
|
||||
var items: [String]
|
||||
do {
|
||||
items = try NSFileManager.defaultManager().contentsOfDirectoryAtPath(unzipPath)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
for (index, item) in items.enumerate() {
|
||||
switch index {
|
||||
case 0:
|
||||
file1.text = item
|
||||
case 1:
|
||||
file2.text = item
|
||||
case 2:
|
||||
file3.text = item
|
||||
default:
|
||||
print("Went beyond index of assumed files")
|
||||
}
|
||||
}
|
||||
|
||||
unzipButton.enabled = false
|
||||
resetButton.enabled = true
|
||||
}
|
||||
|
||||
@IBAction func resetPressed(_: UIButton) {
|
||||
file1.text = ""
|
||||
file2.text = ""
|
||||
file3.text = ""
|
||||
zipButton.enabled = true
|
||||
unzipButton.enabled = false
|
||||
resetButton.enabled = false
|
||||
}
|
||||
|
||||
// MARK: Private
|
||||
|
||||
func tempZipPath() -> String {
|
||||
var path = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)[0]
|
||||
path += "/\(NSUUID().UUIDString).zip"
|
||||
return path
|
||||
}
|
||||
|
||||
func tempUnzipPath() -> String? {
|
||||
var path = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)[0]
|
||||
path += "/\(NSUUID().UUIDString)"
|
||||
let url = NSURL(fileURLWithPath: path)
|
||||
|
||||
do {
|
||||
try NSFileManager.defaultManager().createDirectoryAtURL(url, withIntermediateDirectories: true, attributes: nil)
|
||||
} catch {
|
||||
return nil
|
||||
}
|
||||
|
||||
if let path = url.path {
|
||||
return path
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
24
SwiftExample/SwiftExampleTests/Info.plist
Normal file
24
SwiftExample/SwiftExampleTests/Info.plist
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
36
SwiftExample/SwiftExampleTests/SwiftExampleTests.swift
Normal file
36
SwiftExample/SwiftExampleTests/SwiftExampleTests.swift
Normal file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// SwiftExampleTests.swift
|
||||
// SwiftExampleTests
|
||||
//
|
||||
// Created by Sean Soper on 10/23/15.
|
||||
//
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import SwiftExample
|
||||
|
||||
class SwiftExampleTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
func testPerformanceExample() {
|
||||
// This is an example of a performance test case.
|
||||
self.measureBlock {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,322 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
B215FB32143AD3C7003AC546 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B215FB31143AD3C7003AC546 /* SenTestingKit.framework */; };
|
||||
B215FB63143AD514003AC546 /* SSZipArchiveTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B215FB61143AD514003AC546 /* SSZipArchiveTests.m */; };
|
||||
B215FB65143AD527003AC546 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B215FB64143AD527003AC546 /* libz.dylib */; };
|
||||
B215FB66143AD52D003AC546 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B215FB18143AD3C7003AC546 /* Foundation.framework */; };
|
||||
B215FB67143AD56D003AC546 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = B215FB58143AD460003AC546 /* SSZipArchive.m */; };
|
||||
B215FB68143AD576003AC546 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = B215FB4F143AD460003AC546 /* ioapi.c */; };
|
||||
B215FB69143AD576003AC546 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = B215FB51143AD460003AC546 /* mztools.c */; };
|
||||
B215FB6A143AD576003AC546 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = B215FB53143AD460003AC546 /* unzip.c */; };
|
||||
B215FB6B143AD576003AC546 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = B215FB55143AD460003AC546 /* zip.c */; };
|
||||
B215FB6D143AD6FF003AC546 /* TestArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = B215FB6C143AD6FF003AC546 /* TestArchive.zip */; };
|
||||
B2283D5D155AD80F00F9395A /* Unicode.zip in Resources */ = {isa = PBXBuildFile; fileRef = B2283D5C155AD80F00F9395A /* Unicode.zip */; };
|
||||
B23FCC7F1558F1B70026375C /* TestPasswordArchive.zip in Resources */ = {isa = PBXBuildFile; fileRef = B23FCC7E1558F1B70026375C /* TestPasswordArchive.zip */; };
|
||||
C5AE4E64155A12760045F3ED /* IncorrectHeaders.zip in Resources */ = {isa = PBXBuildFile; fileRef = C5AE4E63155A12760045F3ED /* IncorrectHeaders.zip */; };
|
||||
C5AE4E6D155A8B010045F3ED /* SymbolicLink.zip in Resources */ = {isa = PBXBuildFile; fileRef = C5AE4E6C155A8B010045F3ED /* SymbolicLink.zip */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
B215FB18143AD3C7003AC546 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
B215FB30143AD3C7003AC546 /* SSZipArchiveTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SSZipArchiveTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B215FB31143AD3C7003AC546 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
B215FB4E143AD460003AC546 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt.h; sourceTree = "<group>"; };
|
||||
B215FB4F143AD460003AC546 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ioapi.c; sourceTree = "<group>"; };
|
||||
B215FB50143AD460003AC546 /* ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ioapi.h; sourceTree = "<group>"; };
|
||||
B215FB51143AD460003AC546 /* mztools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mztools.c; sourceTree = "<group>"; };
|
||||
B215FB52143AD460003AC546 /* mztools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mztools.h; sourceTree = "<group>"; };
|
||||
B215FB53143AD460003AC546 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unzip.c; sourceTree = "<group>"; };
|
||||
B215FB54143AD460003AC546 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = "<group>"; };
|
||||
B215FB55143AD460003AC546 /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip.c; sourceTree = "<group>"; };
|
||||
B215FB56143AD460003AC546 /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zip.h; sourceTree = "<group>"; };
|
||||
B215FB57143AD460003AC546 /* SSZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SSZipArchive.h; path = ../SSZipArchive.h; sourceTree = "<group>"; };
|
||||
B215FB58143AD460003AC546 /* SSZipArchive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SSZipArchive.m; path = ../SSZipArchive.m; sourceTree = "<group>"; };
|
||||
B215FB5F143AD514003AC546 /* SSZipArchiveTests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SSZipArchiveTests-Info.plist"; sourceTree = "<group>"; };
|
||||
B215FB61143AD514003AC546 /* SSZipArchiveTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSZipArchiveTests.m; sourceTree = "<group>"; };
|
||||
B215FB64143AD527003AC546 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
|
||||
B215FB6C143AD6FF003AC546 /* TestArchive.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = TestArchive.zip; sourceTree = "<group>"; };
|
||||
B2283D5C155AD80F00F9395A /* Unicode.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = Unicode.zip; sourceTree = "<group>"; };
|
||||
B23FCC7E1558F1B70026375C /* TestPasswordArchive.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = TestPasswordArchive.zip; sourceTree = "<group>"; };
|
||||
C5AE4E63155A12760045F3ED /* IncorrectHeaders.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = IncorrectHeaders.zip; sourceTree = "<group>"; };
|
||||
C5AE4E6C155A8B010045F3ED /* SymbolicLink.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SymbolicLink.zip; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
B215FB2C143AD3C7003AC546 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B215FB65143AD527003AC546 /* libz.dylib in Frameworks */,
|
||||
B215FB66143AD52D003AC546 /* Foundation.framework in Frameworks */,
|
||||
B215FB32143AD3C7003AC546 /* SenTestingKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
B215FB04143AD3C7003AC546 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B215FB4B143AD449003AC546 /* SSZipArchive */,
|
||||
B215FB5E143AD505003AC546 /* SSZipArchiveTests */,
|
||||
B215FB12143AD3C7003AC546 /* Frameworks */,
|
||||
B215FB10143AD3C7003AC546 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B215FB10143AD3C7003AC546 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B215FB30143AD3C7003AC546 /* SSZipArchiveTests.octest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B215FB12143AD3C7003AC546 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B215FB64143AD527003AC546 /* libz.dylib */,
|
||||
B215FB31143AD3C7003AC546 /* SenTestingKit.framework */,
|
||||
B215FB18143AD3C7003AC546 /* Foundation.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B215FB4B143AD449003AC546 /* SSZipArchive */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B215FB57143AD460003AC546 /* SSZipArchive.h */,
|
||||
B215FB58143AD460003AC546 /* SSZipArchive.m */,
|
||||
B215FB4D143AD460003AC546 /* minizip */,
|
||||
);
|
||||
name = SSZipArchive;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B215FB4D143AD460003AC546 /* minizip */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B215FB4E143AD460003AC546 /* crypt.h */,
|
||||
B215FB4F143AD460003AC546 /* ioapi.c */,
|
||||
B215FB50143AD460003AC546 /* ioapi.h */,
|
||||
B215FB51143AD460003AC546 /* mztools.c */,
|
||||
B215FB52143AD460003AC546 /* mztools.h */,
|
||||
B215FB53143AD460003AC546 /* unzip.c */,
|
||||
B215FB54143AD460003AC546 /* unzip.h */,
|
||||
B215FB55143AD460003AC546 /* zip.c */,
|
||||
B215FB56143AD460003AC546 /* zip.h */,
|
||||
);
|
||||
name = minizip;
|
||||
path = ../minizip;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B215FB5E143AD505003AC546 /* SSZipArchiveTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B2283D5C155AD80F00F9395A /* Unicode.zip */,
|
||||
B215FB61143AD514003AC546 /* SSZipArchiveTests.m */,
|
||||
B215FB5F143AD514003AC546 /* SSZipArchiveTests-Info.plist */,
|
||||
C5AE4E63155A12760045F3ED /* IncorrectHeaders.zip */,
|
||||
B215FB6C143AD6FF003AC546 /* TestArchive.zip */,
|
||||
B23FCC7E1558F1B70026375C /* TestPasswordArchive.zip */,
|
||||
C5AE4E6C155A8B010045F3ED /* SymbolicLink.zip */,
|
||||
);
|
||||
name = SSZipArchiveTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
B215FB2F143AD3C7003AC546 /* SSZipArchiveTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = B215FB44143AD3C7003AC546 /* Build configuration list for PBXNativeTarget "SSZipArchiveTests" */;
|
||||
buildPhases = (
|
||||
B215FB2B143AD3C7003AC546 /* Sources */,
|
||||
B215FB2C143AD3C7003AC546 /* Frameworks */,
|
||||
B215FB2D143AD3C7003AC546 /* Resources */,
|
||||
B215FB2E143AD3C7003AC546 /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = SSZipArchiveTests;
|
||||
productName = SSZipArchiveTests;
|
||||
productReference = B215FB30143AD3C7003AC546 /* SSZipArchiveTests.octest */;
|
||||
productType = "com.apple.product-type.bundle";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
B215FB06143AD3C7003AC546 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0440;
|
||||
ORGANIZATIONNAME = "Sam Soffes";
|
||||
};
|
||||
buildConfigurationList = B215FB09143AD3C7003AC546 /* Build configuration list for PBXProject "SSZipArchive" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = B215FB04143AD3C7003AC546;
|
||||
productRefGroup = B215FB10143AD3C7003AC546 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
B215FB2F143AD3C7003AC546 /* SSZipArchiveTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
B215FB2D143AD3C7003AC546 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B215FB6D143AD6FF003AC546 /* TestArchive.zip in Resources */,
|
||||
B23FCC7F1558F1B70026375C /* TestPasswordArchive.zip in Resources */,
|
||||
C5AE4E64155A12760045F3ED /* IncorrectHeaders.zip in Resources */,
|
||||
C5AE4E6D155A8B010045F3ED /* SymbolicLink.zip in Resources */,
|
||||
B2283D5D155AD80F00F9395A /* Unicode.zip in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
B215FB2E143AD3C7003AC546 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
B215FB2B143AD3C7003AC546 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B215FB63143AD514003AC546 /* SSZipArchiveTests.m in Sources */,
|
||||
B215FB67143AD56D003AC546 /* SSZipArchive.m in Sources */,
|
||||
B215FB68143AD576003AC546 /* ioapi.c in Sources */,
|
||||
B215FB69143AD576003AC546 /* mztools.c in Sources */,
|
||||
B215FB6A143AD576003AC546 /* unzip.c in Sources */,
|
||||
B215FB6B143AD576003AC546 /* zip.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
B215FB3F143AD3C7003AC546 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
B215FB40143AD3C7003AC546 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
B215FB45143AD3C7003AC546 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
|
||||
INFOPLIST_FILE = "SSZipArchiveTests-Info.plist";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
B215FB46143AD3C7003AC546 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
|
||||
INFOPLIST_FILE = "SSZipArchiveTests-Info.plist";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUNDLE_LOADER)";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
B215FB09143AD3C7003AC546 /* Build configuration list for PBXProject "SSZipArchive" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
B215FB3F143AD3C7003AC546 /* Debug */,
|
||||
B215FB40143AD3C7003AC546 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
B215FB44143AD3C7003AC546 /* Build configuration list for PBXNativeTarget "SSZipArchiveTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
B215FB45143AD3C7003AC546 /* Debug */,
|
||||
B215FB46143AD3C7003AC546 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = B215FB06143AD3C7003AC546 /* Project object */;
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
//
|
||||
// SSZipArchiveTests.m
|
||||
// SSZipArchiveTests
|
||||
//
|
||||
// Created by Sam Soffes on 10/3/11.
|
||||
// Copyright (c) 2011 Sam Soffes. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SSZipArchive.h"
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
@interface SSZipArchiveTests : SenTestCase <SSZipArchiveDelegate>
|
||||
|
||||
- (NSString *)_cachesPath:(NSString *)directory;
|
||||
|
||||
- (NSString *)_calculateMD5Digest:(NSData *)data;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SSZipArchiveTests
|
||||
|
||||
//- (void)setUp {
|
||||
// [[NSFileManager defaultManager] removeItemAtPath:[self _cachesPath:nil] error:nil];
|
||||
//}
|
||||
|
||||
|
||||
- (void)testZipping {
|
||||
NSString *outputPath = [self _cachesPath:@"Zipped"];
|
||||
NSArray *inputPaths = [NSArray arrayWithObjects:
|
||||
[outputPath stringByAppendingPathComponent:@"Readme.markdown"],
|
||||
[outputPath stringByAppendingPathComponent:@"LICENSE"],
|
||||
nil];
|
||||
NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedArchive.zip"];
|
||||
[SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths];
|
||||
|
||||
// TODO: Make sure the files are actually unzipped. They are, but the test should be better.
|
||||
STAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Archive created");
|
||||
}
|
||||
|
||||
|
||||
- (void)testUnzipping {
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Regular"];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
|
||||
STAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped");
|
||||
|
||||
testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"];
|
||||
STAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped");
|
||||
}
|
||||
|
||||
|
||||
- (void)testUnzippingWithPassword {
|
||||
NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestPasswordArchive" ofType:@"zip"];
|
||||
NSString *outputPath = [self _cachesPath:@"Password"];
|
||||
|
||||
NSError *error = nil;
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath overwrite:YES password:@"passw0rd" error:&error delegate:self];
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"];
|
||||
STAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped");
|
||||
|
||||
testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"];
|
||||
STAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped");
|
||||
}
|
||||
|
||||
- (void)testUnzippingTruncatedFileFix {
|
||||
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"IncorrectHeaders" ofType:@"zip"];
|
||||
NSString* outputPath = [self _cachesPath:@"IncorrectHeaders"];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
NSString* intendedReadmeTxtMD5 = @"31ac96301302eb388070c827447290b5";
|
||||
|
||||
NSString* filePath = [outputPath stringByAppendingPathComponent:@"IncorrectHeaders/Readme.txt"];
|
||||
NSData* data = [NSData dataWithContentsOfFile:filePath];
|
||||
|
||||
NSString* actualReadmeTxtMD5 = [self _calculateMD5Digest:data];
|
||||
STAssertTrue([actualReadmeTxtMD5 isEqualToString:intendedReadmeTxtMD5], @"Readme.txt MD5 digest should match original.");
|
||||
}
|
||||
|
||||
- (void)testUnzippingWithSymlinkedFileInside {
|
||||
|
||||
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"SymbolicLink" ofType:@"zip"];
|
||||
NSString* outputPath = [self _cachesPath:@"SymbolicLink"];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
NSString *testSymlinkFolder = [outputPath stringByAppendingPathComponent:@"SymbolicLink/GitHub.app"];
|
||||
NSString *testSymlinkFile = [outputPath stringByAppendingPathComponent:@"SymbolicLink/Icon.icns"];
|
||||
|
||||
NSError *error = nil;
|
||||
NSString *symlinkFolderPath = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath:testSymlinkFolder error:&error];
|
||||
bool symbolicLinkToFolderPersists = ((symlinkFolderPath != nil) && [symlinkFolderPath isEqualToString:@"/Applications/GitHub.app"]) && (error == nil);
|
||||
|
||||
error = nil;
|
||||
|
||||
NSString *symlinkFilePath = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath:testSymlinkFile error:&error];
|
||||
bool symbolicLinkToFilePersists = ((symlinkFilePath != nil) && [symlinkFilePath isEqualToString:@"/Applications/GitHub.app/Contents/Resources/AppIcon.icns"]) && (error == nil);
|
||||
|
||||
STAssertTrue(symbolicLinkToFilePersists && symbolicLinkToFolderPersists, @"Symbolic links should persist from the original archive to the outputted files.");
|
||||
}
|
||||
|
||||
- (void)testUnzippingWithUnicodeFilenameInside {
|
||||
|
||||
NSString* zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"Unicode" ofType:@"zip"];
|
||||
NSString* outputPath = [self _cachesPath:@"Unicode"];
|
||||
|
||||
[SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self];
|
||||
|
||||
bool unicodeFilenameWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Accént.txt"]];
|
||||
|
||||
bool unicodeFolderWasExtracted = [[NSFileManager defaultManager] fileExistsAtPath:[outputPath stringByAppendingPathComponent:@"Fólder/Nothing.txt"]];
|
||||
|
||||
STAssertTrue(unicodeFilenameWasExtracted, @"Files with filenames in unicode should be extracted properly.");
|
||||
STAssertTrue(unicodeFolderWasExtracted, @"Folders with names in unicode should be extracted propertly.");
|
||||
}
|
||||
|
||||
// Commented out to avoid checking in several gig file into the repository. Simply add a file named
|
||||
// `LargeArchive.zip` to the project and uncomment out these lines to test.
|
||||
//
|
||||
//- (void)testUnzippingLargeFiles {
|
||||
// NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"LargeArchive" ofType:@"zip"];
|
||||
// NSString *outputPath = [self _cachesPath:@"Large"];
|
||||
//
|
||||
// [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath];
|
||||
//}
|
||||
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
||||
- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo {
|
||||
NSLog(@"*** zipArchiveWillUnzipFileAtIndex: `%ld` totalFiles: `%ld` archivePath: `%@` fileInfo:", fileIndex, totalFiles, archivePath);
|
||||
}
|
||||
|
||||
|
||||
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo {
|
||||
NSLog(@"*** zipArchiveDidUnzipFileAtIndex: `%ld` totalFiles: `%ld` archivePath: `%@` fileInfo:", fileIndex, totalFiles, archivePath);
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (NSString *)_cachesPath:(NSString *)directory {
|
||||
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]
|
||||
stringByAppendingPathComponent:@"com.samsoffes.ssziparchive.tests"];
|
||||
if (directory) {
|
||||
path = [path stringByAppendingPathComponent:directory];
|
||||
}
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
if (![fileManager fileExistsAtPath:path]) {
|
||||
[fileManager createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
// Taken from https://github.com/samsoffes/sstoolkit/blob/master/SSToolkit/NSData+SSToolkitAdditions.m
|
||||
- (NSString *)_calculateMD5Digest:(NSData *)data {
|
||||
unsigned char digest[CC_MD5_DIGEST_LENGTH], i;
|
||||
CC_MD5(data.bytes, (unsigned int)data.length, digest);
|
||||
NSMutableString *ms = [NSMutableString string];
|
||||
for (i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
|
||||
[ms appendFormat: @"%02x", (int)(digest[i])];
|
||||
}
|
||||
return [ms copy];
|
||||
}
|
||||
|
||||
@end
|
||||
Binary file not shown.
Reference in New Issue
Block a user