Commit 63cdd914 authored by Roy Marmelstein's avatar Roy Marmelstein

Improved handling of directories inside a zip file

parent b5a63a0c
...@@ -215,6 +215,9 @@ public class Zip { ...@@ -215,6 +215,9 @@ public class Zip {
guard let filePath = path.path else { guard let filePath = path.path else {
throw ZipError.ZipFail throw ZipError.ZipFail
} }
var isDirectory: ObjCBool = false
fileManager.fileExistsAtPath(filePath, isDirectory: &isDirectory)
if !isDirectory {
let input = fopen(filePath, "r") let input = fopen(filePath, "r")
if input == nil { if input == nil {
throw ZipError.ZipFail throw ZipError.ZipFail
...@@ -262,6 +265,7 @@ public class Zip { ...@@ -262,6 +265,7 @@ public class Zip {
free(buffer) free(buffer)
fclose(input) fclose(input)
} }
}
zipClose(zip, nil) zipClose(zip, nil)
// Completed. Update progress handler. // Completed. Update progress handler.
......
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