Re: Losing resource forks in Run Script phase, even with ditto (SOLVED)
Re: Losing resource forks in Run Script phase, even with ditto (SOLVED)
- Subject: Re: Losing resource forks in Run Script phase, even with ditto (SOLVED)
- From: Stephen Kay <email@hidden>
- Date: Tue, 02 Oct 2012 18:16:55 -0400
- Thread-topic: Losing resource forks in Run Script phase, even with ditto (SOLVED)
on 9/30/12 11:08 PM, Stephen Kay at email@hidden wrote:
> I have an .rsrc file (created by merging several resource files together in
> a target's "Build ResourceManager Resources" phase). The file properly has
> all the resources in the resource fork (i.e. It can be viewed with
> Resourcerer, for example, and all the resources are still there.)
>
> In a Run Script phase, all I want to do is rename the file with a different
> extension, say .ksr, for my own purposes.
>
> As soon as the file is renamed with any other extension, the resources fork
> is gone and all of the data is in the data fork. It's like it automatically
> turns it into a data fork.
>
> I've tried copying the file with ditto --rsrc, rsync etc. to no avail. The
> resulting file is always a data fork only, containing all of the data - but
> in the wrong fork.
I thought I'd answer my own question since it took me so long to find the
actual answer.
The "Build ResourceManager Resources" phase creates an .rsrc file, but all
of the data is in the data fork. The .rsrc extension allows it to be viewed
as resources anyway in old res-edit apps like Resourcerer - this confused
me. But the data is actualy all in the data fork. If you change the
extension, it just becomes a file in Resourcerer that looks like it only
contains a data fork. But nothing has actually changed inside the forks.
If you want to merge some separate resource-fork files into a single
resource-based file on OS X in Xcode, and still keep the resources in the
resource fork (which the "Build ResourceManager Resources" cannot do), you
can use the command line ResMerger tool, which allows you to specify source
and destination forks. You can also use this to move the data fork into the
resource fork or vice versa. Reference:
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPa
ges/man1/ResMerger.1.html
Here's an example of a Run Script phase that builds a single resource file
from multiple resource files, similar to a "Build ResourceManager Resources"
phase, but maintains all of them in the resource fork, not the data fork:
/Developer/Tools/ResMerger -srcIs RSRC -dstIs RSRC \
"${SRCROOT}/Resources/File1.ppob" \
"${SRCROOT}/Resources/File2.rsrc" \
"${SRCROOT}/OtherResources/File3.ppob" \
"${SRCROOT}/OtherResources/File4.rsrc" \
-o "${SRCROOT}/Destination/NewResourceFile.rsrc"
Here's an example that simply copies a single file having the resources in
the data fork, and moves them to the resource fork:
/Developer/Tools/ResMerger -srcIs DF -dstIs RSRC \
"${SRCROOT}/Resources/File1.rsrc" \
-o "${SRCROOT}/Destination/NewResourceFile.rsrc"
- Stephen
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Stephen Kay
Karma-Lab :: developers of KARMA
http://www.karma-lab.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden