I'm working on a website that is supposed to store compressed archive files for downloading, for different platforms (Mac and Windows).
Unfortunately, the Mac version of the download uses "resource forks", which I understand is a vendor-specific feature of the MacOS file system that attaches extra data to a file identifier. Previously, the only solution was to create the Mac archive (at that time a .sit
archive, specifically) on a Mac, and manually upload both versions.
I would now like to let the website accept only the Windows file (a regular .zip
that can be decompressed on any file-system), and generate a Mac archive with resource forks automatically. Basically, all I need is some way to generate an archive file on the Linux server (in any reasonably common format that can support resource forks; not sure if .sit
is still the best option) that will yield the correct file structure when decompressed on Mac. As the file system doesn't support forks, the archive probably has to be assembled in memory and written to disk, rather than using any native compression tool.
Is there some software that can do this, or at least some format specification that would allow implementing it from scratch?
(1) Resource (and other "named") forks are legacy technology in macOS. While still supported, no modern software uses resource forks for anything substantial. I'd first suggest reviewing your requirements to see if this is even necessary anymore.
(2) macOS has long settled on
.zip
as the standard / built-in archive format..sit
was a third-party compression application (StuffIt) that has drifted out of favor.(3) Resource forks are translated to non-native filesystems using a naming convention. For example, lets say the file
Chart.jpg
has a resource fork. When macOS writes this to a filesystem that doesn't support named forks it creates two files:Chart.jpg
and._Chart.jpg
, with the latter containing the resource fork and metadata. Typically all that's required is for the.zip
file to contain these two files and macOS unarchiving utility will reassemble the original file, with both forks.I found some files with resource forks and compressed them using macOS's built-in compression command. Here's the content of the archive (
unzip -v Archive.zip
):So it appears that the special filenames are being sequestered in an invisible
__MACOSX
subfolder. All you'd have to do is generate a.zip
file with the same structure and it would be reassembled on a macOS system into a native file with a resource fork.