Commit b5974176 authored by Roy Marmelstein's avatar Roy Marmelstein

Moving documents url away from the Zip class

parent 17e96893
......@@ -40,6 +40,7 @@ extension Zip {
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 self.unzipFile(path, destination: destinationUrl, overwrite: true, password: nil, progress: progress)
return destinationUrl
......@@ -73,6 +74,7 @@ extension Zip {
- returns: NSURL of the destination folder.
*/
public func quickZipFiles(paths: [NSURL], fileName: String, progress: ((progress: Double) -> ())?) throws -> NSURL {
let documentsUrl = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
let destinationUrl = documentsUrl.URLByAppendingPathComponent("\(fileName).zip")
try self.zipFiles(paths, zipFilePath: destinationUrl, password: nil, progress: progress)
return destinationUrl
......
......@@ -31,9 +31,6 @@ public class Zip {
// File manager
let fileManager = NSFileManager.defaultManager()
// Documents folder
let documentsUrl = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL
// MARK: Lifecycle
/**
......
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