Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!brutus.cs.uiuc.edu!apple!Apple.COM!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.sys.mac.programmer Subject: Re: Simple File Manager Question Message-ID: <7450@goofy.Apple.COM> Date: 29 Mar 90 18:04:12 GMT Sender: usenet@Apple.COM Organization: Objects-R-Us, Apple Computer, Inc. Lines: 38 References:<7726@b11.ingr.com> <8751@tekigm2.MEN.TEK.COM> There is something called the Poor Man's Search Path in the File Manager. For compatibility reasons, the File Manager looks in the System Folder on certain calls if it can't find the file in the requested directory. (See Tech Notes 77 & 101.) The behavior you see is the PMSP in action. A more serious case is where you want to save a file and call Delete to make sure it doesn't already exist. Delete also follows the PMSP and you could end up deleting a file in the System Folder. The best way to disable the effects of the PMSP is to use the low-level File Manager calls (with explicit parameter blocks) and to always specify a dirID in the call. (Of course this means making the Hxxx version of the call.) If you specify an explicit dirID, then the File Manager only looks in that directory. In MacApp there is a procedure FillInDirID that takes a parameter block and fill in the dirID field. We used this to ensure that the PMSP was never used. There are other gotchas related to the PMSP. Tech Note 101 talks about the problems with the Resource Manager using it in the call CreateResFile. You can also have the opposite problem. Suppose you wanted to locate your program's preferences file in the System Folder. You might just try opening it in the application's directory, and let the PMSP find it in the System Folder. This will work provided your application is on the same volume as the System Folder. The PMSP doesn't check volumes other than the one you specify in the File Manager call. If the program is on a different volume the PMSP won't be used. (If the volume has a blessed folder it will be searched instead.) Larry Rosenstein, Apple Computer, Inc. Object Specialist Internet: lsr@Apple.com UUCP: {nsc, sun}!apple!lsr AppleLink: Rosenstein1