Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!midway!gsbacd.uchicago.edu!gft_robert From: gft_robert@gsbacd.uchicago.edu (opcode ranger) Newsgroups: comp.sys.mac.programmer Subject: Re: Is AppFile.vRefNum always WDRefNum??? Message-ID: <1991Feb8.204505.1@gsbacd.uchicago.edu> Date: 9 Feb 91 02:45:05 GMT References: <1991Feb4.190115.1@gsbacd.uchicago.edu> <24152@neptune.inf.ethz.ch> Sender: news@midway.uchicago.edu (News Administrator) Organization: University of Chicago Lines: 34 --- In article <24152@neptune.inf.ethz.ch>, mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher) writes: > In article <1991Feb4.190115.1@gsbacd.uchicago.edu>, gft_robert@gsbacd.uchicago.edu (opcode ranger) writes: [...] > |> My problem is this: I need to get the dirID (parent dir id) for each file I get > |> AppFile information for (i.e. for each file which is opened from the Finder > |> with the application). If I know this field is a WDRefNum I can call > |> PBGetWDInfo() on it and find the dirID. If it's not always a WDRefNum I'm not > |> sure if this call will work. > > There is a Technote which describes a technique to determine whether a vRefNum > is a WDRefNum: WDRefNums are given numbers -32768, -32767, -32766 or, if you > prefer hex, $8000, $8001, $8002. Normal vRefNums have numbers 'close to zero'. I did some empirical tests. Actually if you pass PBGetWDInfo() the vRefNum of the root of the volume (or whatever is included in the AppFile.vRefNum field when you launch a file on the root level), PBGetWDInfo() seems to return the correct information. So I just pass it whatever I get in AppFile.vRefNum and I can get back the true vRefNum and the dirID. Of course this won't work on MFS volumes, but I'm prepared to limit the users in that regard. Is there some call in Sys7 which takes a WDRefNum and file name and returns a FSSpec? I wrote my own, but if there's a ToolBox call that would be nice too. Robert ============================================================================ = gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to = = * all my opinions are * compute" = = * mine * -Kraftwerk = ============================================================================