Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!brutus.cs.uiuc.edu!psuvax1!psuvm!cunyvm!byuvax!zebolskyd From: zebolskyd@yvax.byu.edu Newsgroups: comp.sys.mac.programmer Subject: Re: Getting the full pathname? Message-ID: <850zebolskyd@yvax.byu.edu> Date: 14 Oct 89 04:29:24 GMT Lines: 28 In article <4665@internal.Apple.COM>, chewy@apple.com (Paul Snively) writes: >In article <6464@pt.cs.cmu.edu> fryd@g.gp.cs.cmu.edu (Michael Fryd) writes: >> Is there any way to get the real filename and directory name for an open >> file? I would like to avoid trying to parse the filename myself, If >> I can get the Mac to tell me where the file is, Scribe will have a better >> chance of working when system 7 comes out. >> >> Thanks >> Michael Fryd (412) 751-5557 >> MEFCO, Inc. Fax: (412) 751-8403 >> 2401 Coulter Road Arpa: Michael.Fryd@cs.cmu.edu >> McKeesport, PA 15131-4251 > >If you really want the best chance of working properly in the future, >don't use pathnames internally; convert them to volumename/dirID/filename >form and use that internally. And if you know you're running under System 7 >or later, you may or may not wish to use the fileID. If you want the _user_ to be able to see the pathname (and find their way to the file) you can use PBGetWDInfo to get the dirID from your working directory, then PBGetCatInfo to get that directory's parent's dirID, and so on until to get to dirID=2, which will be the root. You get the names along the way from ioNamePtr. That's also how I get the volume name for the volumename/dirID/filename resource I use to save a file's location for future _machine_ use. I can send you Modula-2 source code if you want, but you would probably be better off making your _own_ mistakes instead of trying to find mine. --Lyle D. Gunderson zebolskyd@yvax.byu.edu CIS: 73760,2354