
FB II Compiler
PG PRO
Debugging
Memory
System
Mathematics
Resources
Disk I/O
Windows
Controls
Menus
Mouse
Keyboard
Text
Fonts
Drawing
Sound
Clipboard
Printing
Communication
ASM
|
RESOURCES
Get the volRefNum of a resource file
Anybody know how to get the file name and/or volRefNum of an open resource? Like if I get a res handle using GETNAMEDRESOURCE and I want to find the file that the resource actually lives in (it's not part of my application). Any ideas?
John
Yes, sort of. The Mac filesystem deals with open files as 16-bit integers (the % kind). Though this detail is hidden from you by the FB runtime, each open file has a unique file reference number which is used in most file operations.
Mac files, as you know, have two forks. From the user's point of view, these are two data areas for one file. But to the filesystem, they are two separate files that just happen to have the same name and live in the same folder. The actual data may live in completely different places on disk.
So there is one reference number for the datafork-file and one reference number for the resourcefork-file. The reference number for the resource fork *is* the resource reference number returned by OpenResFile and OpenRFPerm. Once you have an open-file reference number, you can use PBGetFCBInfo to extract the file's name, volume, parent directory, size, ID, and other stuff.
In conclusion: Yes, a resRefNum and a fileRefNum are different beasts - but they are the same KIND of beast.
|