Article View: comp.sys.mac
Article #22765Re: Reading a full pathname in HFS
From: Justin Chris Vallon
Date: Fri, 11 Dec 1987 10:31
Date: Fri, 11 Dec 1987 10:31
37 lines
2107 bytes
2107 bytes
In <3551@hoptoad.uucp>, Tim Maroney said:
>Once you have the (volume, directory) pair, you can call PBGetCatInfo to
>find out what the folder they refer to is named. Then just concatenate that
>with your reply.fName, and you've got a full pathname. Two HFS traps and a
>little trivial string twiddling, and it's party time in Mac City.
Now, I'm sure that this will be flamed if incorrect, but doesn't
PBGetCatInfo return the directory name, not the path name? In other
words, let's say you have a path "HardDisk:Utils:File:ResEdit".
The WDRN refers to "HardDisk:Utils:File:", VolRefNum would refer to
"HardDisk", and dirId to the folder that "ResEdit" lives in. If you
PBGetCatInfo on dirId, the name of the folder is "File", which is
almost what you want.
Basically, you would have to repeat the GetCatInfo, moving up the
tree each time by grabbing the parent's dirId until the dirId becomes
2 which is the root dirId. Some pseudo-code (horrors):
pathName := reply.fName
convert reply.vRefNum into volRefNum and dirId
while dirId <> 2 do (* The file is in a folder, so prepend it's name *)
put directory-name from pbGetCatInfo call & ':' in front of path
dirId gets the parent's dirId
put volume-name from getVolInfo call & ':' in front of path
Notice that this could pose a problem if the final path-name is
longer than 255 characters (at least in Pascal).
Maybe I totally struck out... is it getting warm in here? Did
somebody turn up the heat?
-----
Justin Vallon/Box 3077/1000 Morewood Avenue/Pittsburgh, PA 15213/(412) 268-4528
Arpa: justin.vallon@andrew.cmu.edu BitNet: justin.vallon%andrew@cmccvb
UUCP: ...!{psuvax1, harvard}!andrew.cmu.edu!justin.vallon
-----
Technical Details
Message-ID:
<wVjwa3y00UhngLo0D3@andrew.cmu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!rochester!PT.CS.CMU.EDU!andrew.cmu.edu!jv0l+Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!rochester!PT.CS.CMU.EDU!andrew.cmu.edu!jv0l+ From: jv0l+@andrew.cmu.edu (Justin Chris Vallon) Newsgroups: comp.sys.mac Subject: Re: Reading a full pathname in HFS Message-ID: <wVjwa3y00UhngLo0D3@andrew.cmu.edu> Date: 11 Dec 87 10:31:31 GMT Organization: Carnegie Mellon University Lines: 37 In-Reply-To: <3551@hoptoad.uucp>