support nested zip by calling fclose first

This commit is contained in:
Antoine Cœur
2017-10-10 16:43:46 +08:00
parent 2886108b12
commit 1fd7fa9c29

View File

@@ -434,24 +434,23 @@ BOOL _fileIsSymbolicLink(const unz_file_info *fileInfo);
}
if (fp) {
if (nestedZipLevel && [fullPath.pathExtension.lowercaseString isEqualToString:@"zip"]) {
if ([self unzipFileAtPath:fullPath
toDestination:fullPath.stringByDeletingLastPathComponent
preserveAttributes:preserveAttributes
overwrite:overwrite
nestedZipLevel:nestedZipLevel - 1
password:password
error:nil
delegate:nil
progressHandler:nil
completionHandler:nil]) {
[[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil];
}
}
fclose(fp);
if (preserveAttributes) {
if (nestedZipLevel
&& [fullPath.pathExtension.lowercaseString isEqualToString:@"zip"]
&& [self unzipFileAtPath:fullPath
toDestination:fullPath.stringByDeletingLastPathComponent
preserveAttributes:preserveAttributes
overwrite:overwrite
nestedZipLevel:nestedZipLevel - 1
password:password
error:nil
delegate:nil
progressHandler:nil
completionHandler:nil]) {
[directoriesModificationDates removeLastObject];
[[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil];
} else if (preserveAttributes) {
// Set the original datetime property
if (fileInfo.dos_date != 0) {