diff --git a/README.md b/README.md
index df21158456171cfe1248316bd6b66606aac05232..2ae612a8149524c9f44ff79bf3b2f6d297912975 100644
--- a/README.md
+++ b/README.md
@@ -72,5 +72,5 @@ github "marmelroy/Zip"
### Setting up with [CocoaPods](http://cocoapods.org/?q=Zip)
```ruby
source 'https://github.com/CocoaPods/Specs.git'
-pod 'Zip', '~> 0.2'
+pod 'Zip', '~> 0.3'
```
diff --git a/Zip.podspec b/Zip.podspec
index 644b52cf44f8c67fd10712aab161823cd41cf7b8..2b85e89cd090adac0eda524ce0593446edac9b7b 100644
--- a/Zip.podspec
+++ b/Zip.podspec
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "Zip"
- s.version = "0.3.2"
+ s.version = "0.3.4"
s.summary = "Zip and unzip files in Swift."
# This description is used to generate tags and improve search results.
diff --git a/Zip.xcodeproj/project.pbxproj b/Zip.xcodeproj/project.pbxproj
index 78232441d7a8fbb630d587a6cb1f8e37b460bce9..9bd4a3a7b689fbe4c12d9abcb0e9d9978a865505 100644
--- a/Zip.xcodeproj/project.pbxproj
+++ b/Zip.xcodeproj/project.pbxproj
@@ -556,10 +556,10 @@
buildSettings = {
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 4;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 2;
+ DYLIB_CURRENT_VERSION = 4;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Zip/Info.plist;
@@ -579,10 +579,10 @@
buildSettings = {
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 4;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 2;
+ DYLIB_CURRENT_VERSION = 4;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Zip/Info.plist;
@@ -644,7 +644,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 4;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -692,7 +692,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 4;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -721,7 +721,7 @@
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 2;
+ DYLIB_CURRENT_VERSION = 4;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Zip/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -743,7 +743,7 @@
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 2;
+ DYLIB_CURRENT_VERSION = 4;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Zip/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
diff --git a/Zip/Info.plist b/Zip/Info.plist
index b3703d66409edb148b4addabd527707ed08c0ad7..d917e3642c1228afd28e6ec835a8d7088b681078 100644
--- a/Zip/Info.plist
+++ b/Zip/Info.plist
@@ -15,11 +15,11 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 0.3.2
+ 0.3.4
CFBundleSignature
????
CFBundleVersion
- 2
+ 4
NSPrincipalClass
diff --git a/Zip/Zip.swift b/Zip/Zip.swift
index a74d325d5ca330acf0d0346fb4b4b8e1f8bc8e45..38a97adba89646cd56f0fcc1b20482b741ed3658 100644
--- a/Zip/Zip.swift
+++ b/Zip/Zip.swift
@@ -61,7 +61,7 @@ public class Zip {
let fileManager = NSFileManager.defaultManager()
// Check whether a zip file exists at path.
- guard let path = zipFilePath.path, let destinationPath = destination.path else {
+ guard let path = zipFilePath.path where destination.path != nil else {
throw ZipError.FileNotFound
}
if fileManager.fileExistsAtPath(path) == false || zipFilePath.pathExtension != "zip" {
@@ -134,7 +134,8 @@ public class Zip {
try fileManager.createDirectoryAtPath(fullPath, withIntermediateDirectories: true, attributes: directoryAttributes)
}
else {
- try fileManager.createDirectoryAtPath(destinationPath, withIntermediateDirectories: true, attributes: directoryAttributes)
+ let parentDirectory = (fullPath as NSString).stringByDeletingLastPathComponent
+ try fileManager.createDirectoryAtPath(parentDirectory, withIntermediateDirectories: true, attributes: directoryAttributes)
}
} catch {}
if fileManager.fileExistsAtPath(fullPath) && !isDirectory && !overwrite {
diff --git a/ZipTests/Info.plist b/ZipTests/Info.plist
index 97676baca75e66371df1abb8e953e2f49de5d008..b586a503e09be5ba8b2cf75ae00507e3c98d54ca 100644
--- a/ZipTests/Info.plist
+++ b/ZipTests/Info.plist
@@ -15,10 +15,10 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 0.3.2
+ 0.3.4
CFBundleSignature
????
CFBundleVersion
- 2
+ 4
diff --git a/ZipTests/ZipTests.swift b/ZipTests/ZipTests.swift
index 387abda527f5c94734fa0c11cfba365bed013099..53fe334f054bcdb0d894bd427afc0550c2152234 100644
--- a/ZipTests/ZipTests.swift
+++ b/ZipTests/ZipTests.swift
@@ -147,6 +147,23 @@ class ZipTests: XCTestCase {
XCTFail()
}
}
+
+ func testQuickUnzipSubDir() {
+ do {
+ let bookURL = NSBundle(forClass: ZipTests.self).URLForResource("bb8", withExtension: "zip")!
+ let unzipDestination = try Zip.quickUnzipFile(bookURL)
+ let fileManager = NSFileManager.defaultManager()
+
+ let subDir = unzipDestination.URLByAppendingPathComponent("subDir")
+ let imageURL = subDir.URLByAppendingPathComponent("r2W9yu9").URLByAppendingPathExtension("gif")
+
+ XCTAssertTrue(fileManager.fileExistsAtPath(unzipDestination.path!))
+ XCTAssertTrue(fileManager.fileExistsAtPath(subDir.path!))
+ XCTAssertTrue(fileManager.fileExistsAtPath(imageURL.path!))
+ } catch {
+ XCTFail()
+ }
+ }
}
diff --git a/ZipTests/bb8.zip b/ZipTests/bb8.zip
index 4d903fe1c5323303c51968bed6ab4b38de1bd912..514266d193061fd851c447a37de608daef3136fa 100644
Binary files a/ZipTests/bb8.zip and b/ZipTests/bb8.zip differ