Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PKZipUnarchiver does not create intermediate directories for files #1

Open
nros opened this issue Apr 10, 2012 · 0 comments
Open

PKZipUnarchiver does not create intermediate directories for files #1

nros opened this issue Apr 10, 2012 · 0 comments

Comments

@nros
Copy link

nros commented Apr 10, 2012

The intermediate files are not created while unzipping files. If the ZIP file contains directories, everything works as expected. But if the ZIP utility has not added entries for the intermediate directories, unzipping fails.

usually common command line tools to create zip files omit adding
directory names to the zip file. They are not necessary because
non empty directories can be derived from the file paths.

Previous unzipping in PKZipUnarchiver failed to unzip files if
the directories are not present in the ZIP file. Thus zipping on
the command line under Windows/Linux/MacOS produced an
incompatible ZIP file, espacially if just some files are added
to the ZIP file for incremental updates instead of the whole
directory.

This fix forces the creation of directories prior to unzipping
the files.

Signed-off-by: nros [email protected]

PKToolbox/Sources/Foundation/PKZipUnarchiver.m | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/PKToolbox/Sources/Foundation/PKZipUnarchiver.m b/PKToolbox/Sources/Foundation/PKZipUnarchiver.m
index aa61991..9202d6a 100644
--- a/PKToolbox/Sources/Foundation/PKZipUnarchiver.m
+++ b/PKToolbox/Sources/Foundation/PKZipUnarchiver.m
@@ -76,6 +76,11 @@
attributes:nil
error:outError];
} else {

  •        [fileManager createDirectoryAtPath:[currentFilePath stringByDeletingLastPathComponent]
    
  •               withIntermediateDirectories:YES
    
  •                                attributes:nil
    
  •                                     error:outError];
    
    •    [fileManager createFileAtPath:currentFilePath
                              contents:nil
                            attributes:nil];
      
    -- 1.7.5.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant