[comp.sys.mac.programmer] Standard File Hacking

kent@lloyd.camex.uucp (Kent Borg) (06/16/89)

In article <419@lloyd.camex.uucp> I write:
>About *my* recent question of how to find out the directory of the
>currently selected file in SFGetFile at hook time.  Yes, -1 *
>SFSaveDisk is the volume and CirDirStore is the dirID.  That works.
>What I don't know is a good way to get from there to opening the
>currently selected file with OpenResFile.

I figured it out.  Turns out to be easy.  PBHSetVol was the answer.
Call GetVol and remember the result, stuff a WDPBRec parameter block,
call PBHSetVol, call OpenResFile, call SetVol to restore the
remembered value (see Tech Note 140).

Other than a random set of illegal instruction bombs, it works.  (Must
dig about looking for uninitialized thingies.)  I never did figure out
why my sequence of calls to SetVol didn't do it--I don't really know
what SetVol is supposed to do and Inside Macintosh is very terse on
the subject--but I do know a lot more about HFS now.

Kent Borg
kent@lloyd.uucp
or
...!husc6!lloyd!kent