Extracting Resources from MacOS X Resource Files

Dave dave at looktowindward.com
Thu Jan 22 06:57:04 EST 2009


On 21 Jan 2009, at 16:09, Richard Gaskin wrote:

> Dave wrote:
>
>> I tried the getResource command in revolution, it doesn't seem to   
>> work with Mac OS X .rsrc files. For instance when I run this  
>> script  from a button:
>> on mouseUp
>>    local myFilePathName
>>    local myResourceData
>>    local myResult
>>    put "/Users/Dave/Desktop/iTunesImages/myFile.rsrc" into   
>> myFilePathName
>>    put getResources(myFilePathName) into myResourceData
>>    put the result into myResult
>> end mouseUp
>> myResourceData and myResult are both empty, yet when I look at  
>> the  file with ThemePark it show the Icons and Files ok. The  
>> myFile.rsrc I  used here was taken from iTunes in the Resources  
>> folder inside the  App Package.
>> What I really want is to convert the pngs and icns into JPEG images.
>
> The getResources function works on the resource fork only, added  
> back in the OS 8.5 days and increasingly Apple is migrating away  
> from using resource forks so it's not so useful under OS X.*
>
> So while that explains why you're not getting what you're looking  
> for with that, I'm confused about what's in iTunes .rsrc file.  It  
> seems its icons are stored in  several dozen .icns files within the  
> bundle's "Resources" folder.  With a tool or external that can  
> extract the image data from them (could conceivably be done with a  
> script too) it would seem those icns files are where you would  
> obtain those images.
>
> Yet the iTunes .rsrc file weighs in at more than 10MB.  What's in it?

There are a *lot* of icons! Download ThemePark and look. For instance  
there is an Icon for every iPod on the market in every color, when  
you include all resolutions from 512x512 (in some cases) down plus  
all the masks. There are also png images and a lot of strings. I just  
want to be able to access this rsrc file to get an icns file, then  
access the icns file to get the rendered version of the Icon at a  
given resolution.
>
> * I'll take this opportunity to make another prediction about  
> Apple: one of the next major changes to the OS seems likely to be  
> migrating away from HSF to the same file system used by Unix/ 
> Linux.  The downside to this migration is the final end of the old  
> resource forks, but the upside would be complete compatibility with  
> most of the non-Microsoft world while further marginalizing  
> Windows, drawing attention to it being a technological island.
>
> Similar in scope to the other major transitions (68k->PPC, Classic- 
> >OS X, PPC->Intel) this will be somewhat disruptive during the  
> transitional phase, but will also carry an upside for vendors as  
> the previous transitions did by artificially enhancing demand for  
> software upgrades which would otherwise be dependent on features  
> alone.
>
> I'll go further out on a limb to predict this will be announced  
> within the next three years.
>

I wouldn't be surprised if they did do this. Seems like they are hell- 
bent on getting rid of anything good from the Mac OS. The last time I  
looked HFS was a much better filing system than the Unix filesystem.

Thanks a lot
All the Best
Dave





More information about the use-livecode mailing list