I have a zip file. I open it using the ZipArchive php library and add the directory and file to it. When I retrieve it with the default unarchiver of Ubuntu, everything works as expected. But when I retrieve it with any unarchiver on OS X Snow Leopard (using Keka and The Unarchiver by default), the new permissions for the directory are 700. Expected permissions are 755.
So here is the original zip:
DIRECTORY
a.txt
b.txt
Here is my code:
<?php
$file = 'example.zip';
$zip = new ZipArchive;
$res = $zip->open($file, ZipArchive::CREATE);
if ($res === TRUE) {
$zip->addEmptyDir('DIRECTORY/NEW_DIR');
$zip->addFromString('DIRECTORY/NEW_DIR/c.txt', 'hellooo');
$zip->close();
}
else {
print 'error';
}
And the result:
DIRECTORY -> NEW_DIR -> c.txt
a.txt
b.txt
which is true, but the permissions of the NEW_DIR directory are 700 (drwx ------) instead of 755 if I extract it under osx. How to fix it?
Thank!
EDIT:
Here's the zipinfo about the files in my zip:
$ zipinfo -l test.zip
(..)
drwxr-xr-x 3.0 unx 0 bx 0 stor 13-Dec-11 17:43 DIRECTORY/
-rw-r
-rw-r
-rw
-rw
source
share