Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!pyramid!pesnta!amd!amdcad!lll-crg!topaz!harvard!olson From: olson@harvard.UUCP Newsgroups: net.micro.mac Subject: Re: Directory name from DirID? Message-ID: <20@harvard.UUCP> Date: Mon, 16-Jun-86 07:23:33 EDT Article-I.D.: harvard.20 Posted: Mon Jun 16 07:23:33 1986 Date-Received: Tue, 17-Jun-86 23:45:38 EDT References: <157@zyx.UUCP> <158@zyx.UUCP> Sender: news@harvard.UUCP Reply-To: olson@endor.UUCP (Eric Olson) Organization: Aiken Comp Lab, Harvard Lines: 36 Keywords: HFS In article <158@zyx.UUCP> grzm@zyx.UUCP (Gunnar Blomberg) writes: >In article <157@zyx.UUCP> grzm@zyx.UUCP (me) writes: >> >> Is there a way to get the directory name from the directory id, >>without searching through the directory tree or going to disk yourself? > > Yes, well, I just found out how to do it (after some serious >macsbugging...). It seems that if you pass -1 as the FDirIndex to >_GetCatInfo it will ignore the filename you gave it and give back info >about the directory (including the name, of course...). Is this documented >anywhere? > Sorry to have bothered you all, but I was rather desperate (not >to mention tired...). >-- >Gunnar Blomberg, ZYX, +46 8 653205, ...mcvax!enea!zyx!grzm Unfortunately, this only works if you are referencing the directory with a WDRefNum (essentially, a VRefNum-like number that refers to a volume AND a directory). That is to say: fname[0]=0; pb.ioCompletion=NIL; pb.ioNamePtr=fname; pb.ioVRefNum= ; pb.ioFDirIndex=-1; pb.ioDirID=0; PBGetCatInfo(&pb,FALSE); will stuff the name of the directory referred to by the WD/VRefNum into fname, it's DirID into ioDirID, and it's parent directory's DirID into ioParID. It will not, however, give you a directory's name from it's DirID. -Eric