[comp.sys.mac.programmer] WDs vs. using real directory IDs

cookr@cpsin2.cps.msu.edu (Robert W Jr Cook) (11/20/90)

Sorry about the bandwidth, but I lost Tom's address...

>Thanks for your reply.  I have a question, though.  If I have a partial
>path name, can I use it with a directory ID?  i.e.  I want to open
>the file ":::Bang:Crash:Wipeout" from directory "A:B:C:D:E".  I know
>that the Mac can handle this if it knows the WDRefNum of "A:B:C:D".  Can
>it do it if it knows the DirID of "A:B:C:D"?  I was given to
>understand that it couldn't.

Well, yes and no... That's not exactly how things happen. But instead, it does
something else...

In the case of A:B:C:D, what is really known is: the WD associated with
directory D, or the directory ID of D. According to IM IV (because I
haven't tried it myself) on page 100, you can specifiy a directory ID
and a partial pathname. This has the one drawback of requiring a volume
reference number also, but that shouldn't be too hard to get.

You just would use PBHOpen (or similar call) specifying the volume
reference number, beginning directory ID, and the partial pathname as
the file name. Its supposed to work ok.

>
  >Essentially, the ways of specifying a file were:
>
>(volumeNumber, DirID, filename)
>or 
>(WDRefNum, partial pathname)
>or
>(full path name)
>
  >Can you get away with:
>(volumeNumber, DirID, path path name)?
>

Yes. See IM IV, page 100. There are four ways of accessing a file.

> Thanks,
>     Tom

Hopefully, this answeres your question. Please email back any problems
you find with this. I'd like to know if IM IV is wrong...

Thanks,

Robert Cook
CPS @ Michigan State Univeristy
"cookr@cpsin.cps.msu.edu"