diff --git a/.gitignore b/.gitignore index 8615121b24a361eb4d1a5f1d06ca38d91202f7ec..a528cff3f89282f4f492d86789a92b1deeab43b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# MacOS +.DS_Store + # Xcode # build/ diff --git a/Zip.xcodeproj/project.pbxproj b/Zip.xcodeproj/project.pbxproj index 452beb6619a07f13d498e826e3455a24f215ac74..917e94d17af7b19fb547864dddb9f762898fa1a3 100644 --- a/Zip.xcodeproj/project.pbxproj +++ b/Zip.xcodeproj/project.pbxproj @@ -493,7 +493,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Roy Marmelstein"; TargetAttributes = { 343F50FE1C8DAEEC0028C434 = { @@ -504,9 +504,11 @@ }; 347E3A731C1DFFB500A11FD3 = { CreatedOnToolsVersion = 7.2; + LastSwiftMigration = 0800; }; 347E3A7D1C1DFFB500A11FD3 = { CreatedOnToolsVersion = 7.2; + LastSwiftMigration = 0800; }; }; }; @@ -714,6 +716,7 @@ SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; SWIFT_INCLUDE_PATHS = "${SRCROOT}/Zip/minizip/**"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -762,6 +765,7 @@ SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_INCLUDE_PATHS = "${SRCROOT}/Zip/minizip/**"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; @@ -901,6 +905,7 @@ SKIP_INSTALL = YES; SWIFT_INCLUDE_PATHS = "${SRCROOT}/Zip/minizip/**"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 2.3; }; name = Debug; }; @@ -922,6 +927,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_INCLUDE_PATHS = "${SRCROOT}/Zip/minizip/**"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 2.3; }; name = Release; }; @@ -932,6 +939,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.ZipTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 2.3; }; name = Debug; }; @@ -942,6 +950,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.ZipTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 2.3; }; name = Release; }; diff --git a/Zip.xcodeproj/xcshareddata/xcschemes/Zip OSX.xcscheme b/Zip.xcodeproj/xcshareddata/xcschemes/Zip OSX.xcscheme index f802b86d77595215664fcbc48ebf23457a6425c3..dbc1918043198585f5287149f8a64a984f18a549 100644 --- a/Zip.xcodeproj/xcshareddata/xcschemes/Zip OSX.xcscheme +++ b/Zip.xcodeproj/xcshareddata/xcschemes/Zip OSX.xcscheme @@ -1,6 +1,6 @@ () in + try Zip.zipFiles([imageURL1, imageURL2], zipFilePath: zipFilePath!, password: nil, progress: { (progress) -> () in print(progress) }) let fileManager = NSFileManager.defaultManager() - XCTAssertTrue(fileManager.fileExistsAtPath(zipFilePath.path!)) + XCTAssertTrue(fileManager.fileExistsAtPath((zipFilePath?.path)!)) } catch { XCTFail() @@ -198,19 +198,23 @@ class ZipTests: XCTestCase { let imageURL2 = NSBundle(forClass: ZipTests.self).URLForResource("kYkLkPf", withExtension: "gif")! let documentsFolder = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL let zipFilePath = documentsFolder.URLByAppendingPathComponent("archive.zip") - try Zip.zipFiles([imageURL1, imageURL2], zipFilePath: zipFilePath, password: "password", progress: { (progress) -> () in + try Zip.zipFiles([imageURL1, imageURL2], zipFilePath: zipFilePath!, password: "password", progress: { (progress) -> () in print(progress) }) let fileManager = NSFileManager.defaultManager() - XCTAssertTrue(fileManager.fileExistsAtPath(zipFilePath.path!)) - guard let fileExtension = zipFilePath.pathExtension, let fileName = zipFilePath.lastPathComponent else { + XCTAssertTrue(fileManager.fileExistsAtPath((zipFilePath?.path)!)) + + let fileExtension = zipFilePath!.pathExtension + let fileName = (zipFilePath?.lastPathComponent)! + + guard fileExtension != nil && fileName.characters.count > 0 else { throw ZipError.UnzipFail } let directoryName = fileName.stringByReplacingOccurrencesOfString(".\(fileExtension)", withString: "") let documentsUrl = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL let destinationUrl = documentsUrl.URLByAppendingPathComponent(directoryName, isDirectory: true) - try Zip.unzipFile(zipFilePath, destination: destinationUrl, overwrite: true, password: "password", progress: nil) - XCTAssertTrue(fileManager.fileExistsAtPath(destinationUrl.path!)) + try Zip.unzipFile(zipFilePath!, destination: destinationUrl!, overwrite: true, password: "password", progress: nil) + XCTAssertTrue(fileManager.fileExistsAtPath(destinationUrl!.path!)) } catch { XCTFail() @@ -225,11 +229,11 @@ class ZipTests: XCTestCase { let fileManager = NSFileManager.defaultManager() let subDir = unzipDestination.URLByAppendingPathComponent("subDir") - let imageURL = subDir.URLByAppendingPathComponent("r2W9yu9").URLByAppendingPathExtension("gif") + let imageURL = subDir!.URLByAppendingPathComponent("r2W9yu9")!.URLByAppendingPathExtension("gif") XCTAssertTrue(fileManager.fileExistsAtPath(unzipDestination.path!)) - XCTAssertTrue(fileManager.fileExistsAtPath(subDir.path!)) - XCTAssertTrue(fileManager.fileExistsAtPath(imageURL.path!)) + XCTAssertTrue(fileManager.fileExistsAtPath(subDir!.path!)) + XCTAssertTrue(fileManager.fileExistsAtPath(imageURL!.path!)) } catch { XCTFail() }