From b295b836f3e523158ac5dc25210bad6df908080c Mon Sep 17 00:00:00 2001 From: Wolfgang Thaller Date: Sat, 18 Oct 2014 00:06:48 +0200 Subject: [PATCH] MakeAPPL: when running on a Mac, put the resource fork where it belongs --- MakeAPPL/main.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/MakeAPPL/main.cc b/MakeAPPL/main.cc index ba79303409..7a2ae6dfde 100644 --- a/MakeAPPL/main.cc +++ b/MakeAPPL/main.cc @@ -28,6 +28,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + std::string commandPath; void wrapMacBinary(std::string macBinaryFile, std::string diskImagePath) @@ -532,6 +536,21 @@ int main(int argc, char *argv[]) } wrapMacBinary(binFileName, dskFileName); +#ifdef __APPLE__ + { + std::ofstream dataOut((outFileName + ".APPL").c_str()); + std::ofstream rsrcOut((outFileName + ".APPL/..namedfork/rsrc").c_str()); + rsrc.writeFork(rsrcOut); + + std::ostringstream finfOut; + ostype(finfOut, "APPL"); + ostype(finfOut, creatorCode); + for(int i = 8; i < 32; i++) + byte(finfOut, 0); + setxattr((outFileName + ".APPL").c_str(), XATTR_FINDERINFO_NAME, + finfOut.str().data(), 32, 0, 0); + } +#else { std::ofstream dataOut((outFileName + ".APPL").c_str()); system("mkdir -p .rsrc"); @@ -545,5 +564,6 @@ int main(int argc, char *argv[]) for(int i = 8; i < 32; i++) byte(finfOut, 0); } +#endif return 0; }