How do I iterate over a Mac Resource Fork

234 views Asked by At

I want to be able to iterate over a Mac OS Resource Fork so a Cocoa Window can show how many resources there is for a specific resource type (I.e., 'MADI'). I want to use the (yes, I know they're deprecated) Carbon Resource Manager functions. The only way I can think of to get all the values is to brute-force my way from SHORT_MIN to SHORT_MAX for each OSType to check for.

Part of the problem is that there's no documentation in the header, and I am loathe to download the legacy API reference due to its size.

1

There are 1 answers

0
MaddTheSane On BEST ANSWER

It seems that I got Get1IndResource() and Get1Resource() mixed up in my brain.

Get1IndResource() iterates based on the order a specific resource is in a resource file/fork, starting from 1 instead of 0 (most likely from when the Mac API was written/used by Pascal). Get1Resource() gets resource data from the resource ID number.