Catalina unzip File Permissions Problems

And a solution which apparently works:

Catalina is more strict (or perhaps just “broken in a new way”) when processing zip files. So, when creating the ZipMBS file for an app which includes exectuable files, you need to set the “version created by” field to version # 2.0 and the OS to “unix” which is done by setting the version value to 0314 hex as shown here:

dim bRaw as boolean = false
dim zipWindowbits as integer = 15  // ignored
dim zipMemLevel as integer = 9 // ignored
dim zipStrategy as integer = ZipMBS.StrategyDefault
dim zipPassword as string=""
dim zipCRC as integer = 0
dim zipFlagBase as integer =0
dim zipFileComment as string =""
dim bUseZip64 as boolean = true

' 4.4.2 version made by (2 bytes)
' 
' 4.4.2.1 The upper byte indicates the compatibility of the file
' attribute information.  If the external file attributes 
' are compatible with MS-DOS and can be read by PKZIP for 
' DOS version 2.04g then this value will be zero.  If these 
' attributes are not compatible, then this value will 
' identify the host system on which the attributes are 
' compatible.  Software can use this information to determine
' the line record format for text files etc.  
' 
' 4.4.2.2 The current mappings are:
' 
' 0 - MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems)
' 1 - Amiga                     2 - OpenVMS
' 3 - UNIX                      4 - VM/CMS
' 5 - Atari ST                  6 - OS/2 H.P.F.S.
' 7 - Macintosh                 8 - Z-System
' 9 - CP/M                     10 - Windows NTFS
' 11 - MVS (OS/390 - Z/OS)      12 - VSE
' 13 - Acorn Risc               14 - VFAT
' 15 - alternate MVS            16 - BeOS
' 17 - Tandem                   18 - OS/400
' 19 - OS X (Darwin)            20 thru 255 - unused
' 
' 4.4.2.3 The lower byte indicates the ZIP specification version 
' (the version of this document) supported by the software 
' used to encode the file.  The value/10 indicates the major 
' version number, and the value mod 10 is the minor version 
' number.  

dim zipVersionMadeBy as uint16 = &h0314 // 03 = unix. 14 hex = 20 decimal  =  version 2.0

z.CreateFile(relativePath+name,zi,"","", zipFileComment, z.MethodDeflated, z.CompressionBestCompression, bUseZip64,bRaw, zipWindowBits, zipMemLevel, zipStrategy, zipPassword, zipCRC, zipVersionMadeBy, zipFlagBase)

Note: zip files traditionally use no compression for Folders (I don’t think this matters, but…) when adding a folder (rather than a file) you might change it slightly to not use any compression at all:

z.CreateFile(relativePath+name,zi,"","", zipFileComment, z.MethodNone, z.CompressionNo, bUseZip64,bRaw, zipWindowBits, zipMemLevel, zipStrategy, zipPassword, zipCRC, zipVersionMadeBy, zipFlagBase)

Note: see also below for code to set the permissions flags: https://forum.xojo.com/conversation/post/475862