Commit c898c506 authored by Jake's avatar Jake

Merge remote-tracking branch 'marmelroy/master'

parents e2615167 5b0f8066
......@@ -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'
```
......@@ -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.
......
......@@ -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";
......
......@@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.3.2</string>
<string>0.3.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2</string>
<string>4</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
......
......@@ -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 {
......
......@@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.3.2</string>
<string>0.3.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2</string>
<string>4</string>
</dict>
</plist>
......@@ -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()
}
}
}
No preview for this file type
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment