Rescuing Files From Classic Mac OS...with Swift!
Summary
Classic Mac OS had this too, of course, but it also had two (well, three) additional kinds of information that were an essential part of the file: its type and creator, and its resource fork. Finally, and most importantly, files had a resource fork, entirely parallel to their regular contents that contained structured data in a table keyed by (again) four-character codes. A variety of container formats were invented to deal with this mismatch between Macs and other computers…but I’m not using any of them, because I’m doing the bare minimum to rescue the contents of the old hard drive. Instead, I implemented what a friend described as “basically cpio”, throwing the file’s name, “catalog info” (basic metadata, including the type and creator codes), data fork, and resource fork across a TCP connection, to be compressed and stored on a modern OS with a much much bigger hard drive until I can get around to writing an unarchiver. The reason for that is twofold: first, so that the representation can be compatible with the Objective-C class NSError on Apple platforms, and second, so that the type fits in a register, and the code can check whether an error was thrown by comparing against .