Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!apple!well!wdh From: wdh@well.UUCP (Bill Hofmann) Newsgroups: comp.sys.mac.programmer Subject: Re: Vol # of Launched APPL? Message-ID: <10507@well.UUCP> Date: 27 Jan 89 17:12:14 GMT References: Reply-To: wdh@well.UUCP (Bill Hofmann) Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 20 In article gf0c+@andrew.cmu.edu (Gregory S. Fox) writes: >The question: How do you determine the directory that the application >resides in, _regardless of the location of the document that launched it_??? Actually, not all that hard. I had to figure it out recently. Remember early on in your program you called GetAppParms() (or did you...). It will return (among other things) the refnum of the application resource file (gleaned from a nasty low-mem global apRefNum). With this piece of information, call PBGetFCBInfo() (IM IV-179) and get ioFCBVRefNum, which is the vRefNum of the folder. This may be a WDRefNum, getting the dirID and the volume vRefNum are left as an exercise for the reader. A minor gotcha can happen if you're using THINK C, which has a .rsrc file which it opens after the "application" if you're just doing a ^R (run). If you want the (say) name of the *resource* file and not the project file, do a Get1Resource on the signature resource, a HomeResFile, and proceed as above. -Bill Hofmann Flashpoint