Path: utzoo!attcan!uunet!lll-winken!ames!ncar!tank!nucsrl!accuvax.nwu.edu!bob From: bob@accuvax.nwu.edu (Bob Hablutzel) Newsgroups: comp.sys.mac.programmer Subject: Re: Vol # of Launched APPL? Message-ID: <10050071@accuvax.nwu.edu> Date: 26 Jan 89 14:02:29 GMT References: Organization: Northwestern U, Evanston IL, USA Lines: 30 > Greetings... > The situation: An application, a configuration file, and a preferences > file. The application and the configuration file are in Folder A, the > pref file in Folder B. Double click the config file, the appl launches > without difficulty. Double click the pref file, and the default dir is > Folder B, so although the appl is launched, it can't find the config > file. Sort of a fox, goat, cabbage problem. > The question: How do you determine the directory that the application > resides in, _regardless of the location of the document that launched it_??? > I've pondered this one for a while. It seems like a worthwhile thing > to know, so if I figure it out first, I'll post the answer myself. I haven't tried this, but it should work: At program startup, get the CurResFile. This gives you a refNum to the current application. Call _GetFCBInfo (see Inside Macintosh, Page 179) with ioRefNum set to the CurResFile refNum, and ioFCBIndx set to zero. This will return in ioVRefNum a vRefNum (probably actually a WDRefNum) for the disk (folder) holding the application. Good luck. > -Greg Bob Hablutzel Wildwood Software BOB@NUACC.ACNS.NWU.EDU