Path: utzoo!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!agate!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Vol # of Launched APPL? Message-ID: <6389@hoptoad.uucp> Date: 26 Jan 89 17:36:38 GMT References: Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 35 In article gf0c+@andrew.cmu.edu (Gregory S. Fox) writes: >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_??? IMNSHO, all configuration and preferences files should be in the system folder. There are two main reasons. First, everyone else does it that way, so you're less likely to confuse the user by sticking to the de facto convention. Second, on file servers, many people may be using the same copy of the application, but they are all likely to have their own system folders, so this way you avoid conflicts. Also, I don't think there should be two files; configuration and preferences ought to go in the same file. All that said, it's pretty easy to find where the application is. Use the low-memory global CurAppRefNum to find the reference number of the application resource file. You can accomplish the same thing in a more future-compatible way using the CurResFile system function, as long as you haven't opened any more resource files. Then call PBGetFCBInfo using that reference number. The ioVRefNum and ioFCBParID in the parameter block on return contain the information you desire. -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "The men promise to provide unconditionally for their wives. The women in turn serve unconditionally to provide the other household services necessary for the men to fulfill their obligations to the women. The women are satisfied because they have the men working for THEM." -- Colin Jenkins, soc.women