ZIPPED OS X files are corrupted

Author: BitRock Support       Date: February 25, 2009 12:50       Tags: Actions
Tips
OS X
Native Packaging

The problem is related to the resource forks of the file that has been compressed. In OS X, the resource forks are saved under a hidden file called <filename>/rsrc, but when zipping the file, OS X silently stores the resource forks inside the zip under a folder named "__MACOSX". The problem is that you can't recover the resource forks in other operating systems, nor you can do it in OS X 10.3 or earlier using the regular "unzip" command line tool (10.4 or later do support resource forks in unzip). What we recomend you to do is either to:

- Do not zip the original file. InstallBuilder will take care of the resource forks, populating them in OS X in a transparent way. Also, as you know InstallBuilder has ZIP compression, so you gain very little by already having the file zip-compressed.

- If you still want to preserve the file zipped, when you uncompress the file in the <postInstallationActionList>, do it through a "open" command instead of an "unzip" command, like the following:

  <runProgram>
    <program>open</program>
    <programArguments>/some/folder/your.zip</programArguments>
    <workingDirectory>/some/folder</workingDirectory>
  </runProgram>

The open command will re-populate the resource forks so they will be again available as /rsrc. Be careful though that the "open" command returns control immediately after invocation, so you would need to place a (wait five seconds) action after the mentioned (of course you can customize the wait interval to a safe value, in case you have a big file that takes time to uncompress). That way the uncompressed file will be fully available after the wait.

Note as well that we have set the <workingDirectory> element, so the .zip file will be uncompressed in the same folder where it resides.

See also the related Mac OS X resource forks article

 

Back You should login to comment

 

You are
currently not
logged in.

 Log in 

or

Sign up