Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: Standard File and Working directories... Message-ID: <54410@apple.Apple.COM> Date: 27 Jun 91 22:51:42 GMT References: <1991Jun26.084825.9019@dartvax.dartmouth.edu> <14699@dog.ee.lbl.gov> Organization: Apple Computer Inc., Cupertino, CA Lines: 47 In article <14699@dog.ee.lbl.gov> eastman@csa2.lbl.gov writes: >In article <1991Jun26.084825.9019@dartvax.dartmouth.edu>, llama@eleazar.dartmouth.edu (Joe Francis) writes... >>chuck@brain.UUCP (Chuck Shotton) writes: >> >>>Given the raft of Tech Notes on the subject, and the general noise concerning >>>them, I get the impression that Working Directories have fallen from grace. >>>Do they serve a purpose anymore? Why would I ever use one? (This IS a serious >>>question.) >> >>In answer to why would you ever use one... >> >>Before there were the new high level file manager calls (doc'd in a tech >>note, then put in IM VI), the only way I know of to take a Volume Name, >>Dir ID, and File Name and manage to open that file is to open a working >>directory. I would LOVE to be proven wrong on this, so please post any >>alternatives (given the above assumptions). >> > >Let us also not forget tech note #140, "Why PBHSetVol is Dangerous", wherein >we learn that using _HSetVol to change the default directory is a no-no. If >you want to change the default directory to a given vRefNum+dirID, and you >want to be compatible with all post-HFS systems, you have to compose a working >directory and pass it to PBSetVol instead. > >I presume the bad behavior has been fixed in some more recent version of the >System, but I haven't seen a revised TN 140 that tells me so. Am I wrong? Jack, I don't think that you read Technote #140 all the way through. The problem with HSetVol has to do with compatability with applications programmed for pre-HFS systems. It has nothing to do with being compatible with post-HFS systems. Since there is nothing Apple can do about "fixing" old applications, there's nothing that can be done in a "more recent version of the system" to fix the problem. By the way, there's nothing wrong with using HSetVol. Just don't leave the default directory set to that directory. For example, HOpenResFile uses HSetVol. However, before it returns, it carefully restores the default directory back to its previous setting. -- ------------------------------------------------------------------------------ Keith Rollin --- Apple Computer, Inc. INTERNET: keith@apple.com UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith "But where the senses fail us, reason must step in." - Galileo