Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!csd4.milw.wisc.edu!indri!uflorida!haven!umd5!zben From: zben@umd5.umd.edu (Ben Cranston) Newsgroups: comp.sys.mac.programmer Subject: Re: Standard File Dialog Hacking Summary: It doesn't even MAKE a wdRefNum till the very end... Message-ID: <4993@umd5.umd.edu> Date: 9 Jun 89 18:57:10 GMT References: <414@lloyd.camex.uucp> Reply-To: zben@umd5.umd.edu (Ben Cranston) Organization: University of Maryland, College Park Lines: 31 In article <414@lloyd.camex.uucp> kent@lloyd.UUCP (Kent Borg) writes: > In the hook routine for SFPGetFile I can find out the name of the > currently highlighted file by looking at reply.fName. ... > I don't know how to find out what directory it is in. > reply.vRefNum doesn't seem to get updated until the user clicks `Open'. > I want to find out from within the hook routine--while the dialog is up. I think you're out of luck here. Standard File doesn't even make the working directory until the very end. While it is running it is using the Directory ID stuff (see Inside Mac, Volume IV, top of page 92). The Directory ID of the current directory is stored at -616(A6) in Standard File's stack frame, but it would be a bad mistake to rely upon this information. Seems to me it would be a bit expensive to create and destroy working directories everytime you move around, which is what Standard File would have to do to update SFReply.vRefNum on the fly. Still, the Macintosh is ABOUT doing the right thing for the user, even though it's a little expensive. If we cared that much about expenses we would still be using 40x12 upper case only ADM3 terminals (or model 29 teletypes or something). Is there still anybody at Apple with this vision, or did the unix types chase them out? N.B. The way I read the code Standard File only creates a working directory if the file is down in the hierarchy. If the file is at the very top level it returns a real VRefNum for the volume. This should work in all cases, except perhaps doing a PBGetWDInfo on it. I suppose the file system could return the same volume and directory ID 2, but what would it dummy up for ioWDProcID? -- Ben Cranston (Kingdom of Merryland UniSys 1100/92) Copyright 1989 (you may redistribute ONLY if your recipients can).