Commit c898c506 authored by Jake's avatar Jake

Merge remote-tracking branch 'marmelroy/master'

parents e2615167 5b0f8066
...@@ -72,5 +72,5 @@ github "marmelroy/Zip" ...@@ -72,5 +72,5 @@ github "marmelroy/Zip"
### Setting up with [CocoaPods](http://cocoapods.org/?q=Zip) ### Setting up with [CocoaPods](http://cocoapods.org/?q=Zip)
```ruby ```ruby
source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/CocoaPods/Specs.git'
pod 'Zip', '~> 0.2' pod 'Zip', '~> 0.3'
``` ```
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "Zip" s.name = "Zip"
s.version = "0.3.2" s.version = "0.3.4"
s.summary = "Zip and unzip files in Swift." s.summary = "Zip and unzip files in Swift."
# This description is used to generate tags and improve search results. # This description is used to generate tags and improve search results.
......
...@@ -556,10 +556,10 @@ ...@@ -556,10 +556,10 @@
buildSettings = { buildSettings = {
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 4;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 2; DYLIB_CURRENT_VERSION = 4;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A; FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Zip/Info.plist; INFOPLIST_FILE = Zip/Info.plist;
...@@ -579,10 +579,10 @@ ...@@ -579,10 +579,10 @@
buildSettings = { buildSettings = {
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 4;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 2; DYLIB_CURRENT_VERSION = 4;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A; FRAMEWORK_VERSION = A;
INFOPLIST_FILE = Zip/Info.plist; INFOPLIST_FILE = Zip/Info.plist;
...@@ -644,7 +644,7 @@ ...@@ -644,7 +644,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 4;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
...@@ -692,7 +692,7 @@ ...@@ -692,7 +692,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 4;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
...@@ -721,7 +721,7 @@ ...@@ -721,7 +721,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 2; DYLIB_CURRENT_VERSION = 4;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Zip/Info.plist; INFOPLIST_FILE = Zip/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
...@@ -743,7 +743,7 @@ ...@@ -743,7 +743,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 2; DYLIB_CURRENT_VERSION = 4;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Zip/Info.plist; INFOPLIST_FILE = Zip/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.3.2</string> <string>0.3.4</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2</string> <string>4</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string></string> <string></string>
</dict> </dict>
......
...@@ -61,7 +61,7 @@ public class Zip { ...@@ -61,7 +61,7 @@ public class Zip {
let fileManager = NSFileManager.defaultManager() let fileManager = NSFileManager.defaultManager()
// Check whether a zip file exists at path. // Check whether a zip file exists at path.
guard let path = zipFilePath.path, let destinationPath = destination.path else { guard let path = zipFilePath.path where destination.path != nil else {
throw ZipError.FileNotFound throw ZipError.FileNotFound
} }
if fileManager.fileExistsAtPath(path) == false || zipFilePath.pathExtension != "zip" { if fileManager.fileExistsAtPath(path) == false || zipFilePath.pathExtension != "zip" {
...@@ -134,7 +134,8 @@ public class Zip { ...@@ -134,7 +134,8 @@ public class Zip {
try fileManager.createDirectoryAtPath(fullPath, withIntermediateDirectories: true, attributes: directoryAttributes) try fileManager.createDirectoryAtPath(fullPath, withIntermediateDirectories: true, attributes: directoryAttributes)
} }
else { else {
try fileManager.createDirectoryAtPath(destinationPath, withIntermediateDirectories: true, attributes: directoryAttributes) let parentDirectory = (fullPath as NSString).stringByDeletingLastPathComponent
try fileManager.createDirectoryAtPath(parentDirectory, withIntermediateDirectories: true, attributes: directoryAttributes)
} }
} catch {} } catch {}
if fileManager.fileExistsAtPath(fullPath) && !isDirectory && !overwrite { if fileManager.fileExistsAtPath(fullPath) && !isDirectory && !overwrite {
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>BNDL</string> <string>BNDL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.3.2</string> <string>0.3.4</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2</string> <string>4</string>
</dict> </dict>
</plist> </plist>
...@@ -148,5 +148,22 @@ class ZipTests: XCTestCase { ...@@ -148,5 +148,22 @@ class ZipTests: XCTestCase {
} }
} }
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