.rsrc how to

  • Hi lists,

    How do I get the data from a file with an extension of ".rsrc"... I
    found one inside the Finder.app called Finder.rsrc. How do I get all
    the data from a ".rsrc" or resource file specially those PNG images.

    --
     -- -- -- -- -- -- -- -- -- -- --
              welemski
     -- -- -- -- -- -- -- -- -- -- --
  • On Oct 13, 2006, at 6:40 AM, .::welemski::. wrote:

    > Hi lists,
    >
    > How do I get the data from a file with an extension of ".rsrc"... I
    > found one inside the Finder.app called Finder.rsrc. How do I get all
    > the data from a ".rsrc" or resource file specially those PNG images.

    Resorcerer or ResEdit in the Classic Environment.
  • Also note that:
    1. There is nothing (to my knowledge) such as PNG images in .rsrc files.
      Images are usually embedded as PICT resources.
    2. You may run into copyright issues.
    3. This is not Cocoa-related, you may want to take it to the carbon
    list (if anywhere).
    Regards,

    Martin

    HairerSoft
    http://www.hairersoft.com/
  • If you need to open .rsrc files in your program, you'll most likely have to
    use Carbon Calls to open the resource fork of the file you want. You can then
    use Resource manager calls to manipulate the individual resources.

    I'm new to Cocoa, there may be Cocoa API's that can do this, but I doubt it.
  • On Friday, October 13, 2006, at 08:54AM, <PRzeznik...> wrote:

    > If you need to open .rsrc files in your program, you'll most likely have to
    > use Carbon Calls to open the resource fork of the file you want. You can then
    > use Resource manager calls to manipulate the individual resources.
    >
    > I'm new to Cocoa, there may be Cocoa API's that can do this, but I doubt it.

    There are no Cocoa wrappers (at least that Apple supplies) around the Carbon Resource Manager.

    For the conversion part of my app (converts older res-based documents), I use the ResMgr APIs to obtain the resource data and just map them in memory-based structures.

    > From there, I can do whatever I want.  Just be careful to realize...

    (1) resources are 16-bit aligned; use appropriate pragma pack, et. al to wrap your structs so that they map to the loaded resources correctly.

    (2) The built in res-types (16-bit, 32-bit, etc. scalars) are all BigEndian so be sure to add in byte-swapping.  You'll typically use the "NSSwapBigEndianToHost" functions. Although, it could be the case where a resource contains a blob of data such that the original developer defined its "endian-ness".

    --
    Rick Sharp
    Instant Interactive(tm)
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today