Skip to main content

Module maczip

Module maczip 

Source
Expand description

MacZip — Info-ZIP’s Macintosh port (D. Haase), the “new” Mac3 format.

MacZip writes a standard PKZIP archive where each Mac file becomes a normal ZIP entry (the data fork) plus a second entry for the resource fork, stored under a XtraStuf.mac/ directory component (the ResourceMark, "XtraStuf.mac:" on a real Mac). Per-file Finder metadata rides in a Mac3 (0x334D) extra field present on both the local and central header:

Mac3 extra block (id 'M','3' = 0x334D, little-endian):
  +0  u16  TSize        block data size = 14 + compsize (local) / 14 (central)
  --- block data (TSize bytes) ---
  +0  u32  attrsize     uncompressed size of the attribute blob
  +4  u16  info flags   EB_M3_FL_* (bit0 DATFRK, bit2 UNCMPR, ...)
  +6  u32  fdType       4 chars, native (big-endian) order
  +10 u32  fdCreator    4 chars
  +14 ..   attribute blob (LOCAL header only; absent in central)

Type/creator live uncompressed in the fixed part. The attribute blob (only in the local header) carries fdFlags + dates + folder settings + comment, and is itself memcompressed unless the UNCMPR (0x04) bit is set: [u16 method][u32 crc][raw-deflate stream]. Within the decompressed blob, fdFlags is the first u16 and the create/modify dates are at +26/+30 (Mac 1904-epoch seconds), matching the StuffIt/MacBinary date convention.

Detection is content-driven: a plain disk-image-in-a-zip carries no Mac3 field, so is_maczip returns false for it (see the .zip overload note in docs/maczip_plus_fixes.md).

Format reference: the MacZip 1.06 source (zip/macos/source/extrafld.c writer + unzip/macos/source/macos.c reader).

Functions§

is_maczip
Quick content check: is this a MacZip archive (vs. a plain disk-image zip)? True iff it’s a ZIP whose central directory carries at least one Mac3 (or old JLEE) extra field — the signal a plain zip never has.
parse
Parse a MacZip archive into the family’s StuffItArchive model. Returns the decompressed-fork buffer (entries reference it with method-0/store ForkInfo) plus the parsed directory, so the whole extract/browse path is reused unchanged.