Simple archiver based on libminizip.
- Updated to minizip
2.8.9
Compatibility note
There are several ways to create a zip file on macOS. Not all of them are valid for archiving apps.
- Archive Utility
/System/Library/CoreServices/Applications
When a zip file is created via the Finder, the result is essentailly the same as using ditto
with the option --sequesterRsrc
.
ditto -c -k --sequesterRsrc --keepParent test test.zip
Note: The source and destination paths are passed in the reverse order for ditto
compared to zip
or minizip
.
drwxr-xr-x 2.1 unx 0 bx stor 19-Sep-09 14:18 test/
-rw-r--r-- 2.1 unx 6148 bX defN 19-Sep-09 14:17 test/.DS_Store
drwxrwxr-x 2.1 unx 0 bx stor 19-Sep-09 14:18 __MACOSX/
drwxrwxr-x 2.1 unx 0 bx stor 19-Sep-09 14:18 __MACOSX/test/
-rw-r--r-- 2.1 unx 120 bX defN 19-Sep-09 14:17 __MACOSX/test/._.DS_Store
drwxr-xr-x 2.1 unx 0 bx stor 19-Sep-09 14:16 test/folder/
lrwxr-xr-x 2.1 unx 33 b- stor 19-Sep-09 14:18 test/a
7 files, 6301 bytes uncompressed, 338 bytes compressed: 94.6%
We can assertain a few things:
- Invisble files are stored
- Symbolic links are stored
- Resource forks and HFS meta-data are stored in a directory named
__MACOSX
- UNIX file attributes are stored
- Platform is
unx
- Minizip (zlib version)
minizip test.zip test
-rw---- 0.0 fat 0 b- defN 80-Jan-00 00:00 test
1 file, 0 bytes uncompressed, 2 bytes compressed: 0.0%
We can see that the program is quite limited.
- Invisble files are NOT stored
- Symbolic links are NOT stored
- UNIX file attributes are NOT stored
- Dates are NOT stored
- Platform is
fat
- Zip
/usr/bin/zip
zip -r -y test.zip test
Zip file size: 893 bytes, number of entries: 4
drwxr-xr-x 3.0 unx 0 bx stor 19-Sep-09 14:18 test/
-rw-r--r-- 3.0 unx 6148 bx defN 19-Sep-09 14:27 test/.DS_Store
drwxr-xr-x 3.0 unx 0 bx stor 19-Sep-09 14:16 test/folder/
lrwxr-xr-x 3.0 unx 33 bx stor 19-Sep-09 14:18 test/a
- Invisble files are stored
- Symbolic links are stored
- UNIX file attributes are stored
- Platform is
unx
- Minizip (nmoinvaz version)
minizip -y test.zip test
`
Zip file size: 764 bytes, number of entries: 3
-rw-r--r-- 6.3 osx 6148 bX defN 19-Sep-09 14:27 .DS_Store
drwxr-xr-x 6.3 osx 0 b- stor 19-Sep-09 14:16 folder/
lrwxr-xr-x 6.3 osx 0 bX defN 19-Sep-09 14:16 a
- Invisble files are stored
- Symbolic links are stored but the content (path) is missing
- UNIX file attributes are stored
- Platform is
osx
In order to keep integrity we want the following features:
- Ignore invisble files
- Ignore Resource forks and HFS meta-data
- Store symbolic links with their paths
- Store UNIX file attributes
- Store dates
- Store platform as
osx
(optional)
Unfortunately, neither the madler
or nmoinvaz
seems to tick all boxes.
The plugin is based on the nmoinvaz
minizip
code with some modifications to ignore invisible files and store symbolic links with their paths. This is critical for creating a zip that can be unarchived on macOS 10.15 Catalina.
Note: If you transfer a zipped app over a network (AirDrop, email, FTP:, HTTP:, etc.) the file will be marked with some Finder attributes that will signal GateKeeper to block its execution. You can remove such attributes with xattr -r -c
or xattr -r -d com.apple.quarantine
.
success:=Zip (src;dst;pass;level;options;callback;codepage)
Zip options
Property | Type | Description |
---|---|---|
ZIP_Ignore_hidden | LONGINT | |
ZIP_With_attributes | LONGINT | |
ZIP_Without_enclosing_folder | LONGINT | |
ZIP_With_encryption | LONGINT | |
ZIP_BZ2 | LONGINT | |
ZIP_7Z | LONGINT |
Zip Compression Level
Property | Type | Description |
---|---|---|
ZIP_Compression_level_default | LONGINT | |
ZIP_Compression_level_0 | LONGINT | |
ZIP_Compression_level_1 | LONGINT | |
ZIP_Compression_level_2 | LONGINT | |
ZIP_Compression_level_3 | LONGINT | |
ZIP_Compression_level_4 | LONGINT | |
ZIP_Compression_level_5 | LONGINT | |
ZIP_Compression_level_6 | LONGINT | |
ZIP_Compression_level_7 | LONGINT | |
ZIP_Compression_level_8 | LONGINT | |
ZIP_Compression_level_9 | LONGINT |
Zip Charset
Property | Type | Description |
---|---|---|
Zip_Charset_automatic | LONGINT | |
{any} | LONGINT | windows code page |
result:=Unzip (src;dst;pass;options;callback;codepage)