Commit b48db457 authored by Roy Marmelstein's avatar Roy Marmelstein

Allow unzipping password protected files

parent a88d3d35
...@@ -42,7 +42,12 @@ public class Zip { ...@@ -42,7 +42,12 @@ public class Zip {
let bufferSize: UInt32 = 4096 let bufferSize: UInt32 = 4096
var buffer = Array<CUnsignedChar>(count: Int(bufferSize), repeatedValue: 0) var buffer = Array<CUnsignedChar>(count: Int(bufferSize), repeatedValue: 0)
repeat { repeat {
ret = unzOpenCurrentFile(zip) if let cPassword = password?.cStringUsingEncoding(NSASCIIStringEncoding) {
ret = unzOpenCurrentFilePassword(zip, cPassword)
}
else {
ret = unzOpenCurrentFile(zip);
}
if ret != UNZ_OK { if ret != UNZ_OK {
throw ZipError.UnzipError throw ZipError.UnzipError
} }
......
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