Expand description
Magic-sniff classifier for Mac archive bytes. Returns a single
MacArchiveKind regardless of filename extension, so the GUI
workflows in OPEN-WORK §6.1 can trigger off the actual file content
rather than a possibly-misleading name.
Detection order:
- BinHex 4.0 (textual banner). If it decodes, re-sniff the inner
data fork: a SIT/SIT5 payload yields
BinHexOverSit, a SEA payload yieldsBinHexOverSea, anything else yieldsBinHexSingleFile(one Mac file’s worth of forks). - Standalone classic StuffIt
SIT!. - Standalone StuffIt 5.
- Standalone SEA (Mac app data fork with a SIT! signature inside).
Anything else: None. The caller treats it as opaque bytes.
Enums§
- MacArchive
Kind - What kind of Mac archive a byte buffer is, if any.
- Mountable
Image Kind - A disk-image payload an archive’s single entry can resolve to.
Returned by
detect_mountable_image— the Workflow A and D.2 auto-unwrap hint uses this to surface “Mount in new Inspect tab” when the user picks an archive whose contents are themselves a disk image.
Functions§
- detect_
mac_ archive - Classify
bytesas a Mac archive if possible. Filename extension is irrelevant — detection runs purely on content magic. ReturnsNonefor anything that doesn’t match a known archive shape. - detect_
mountable_ image - Sniff a decompressed payload for “is this a disk image the Inspect tab can mount and partition-walk?” Tries DiskCopy 4.2 first (header at offset 0 plus size match), then raw HFS / HFS+ (MDB signature at byte 1024 — the BasiliskII HFV layout and the Apple_HFS partition layout share this offset).