[comp.sys.mac.programmer] full pathname for a file - how to get?

d83_sven_a@tekno.chalmers.se (Sven (Sciz) Axelsson) (06/14/89)

I'm sure this has been out on the net before, but since I missed it then - 
can someone please thell me how to get a file's full pathname given the
information returned by SFGetFile?
Code-examples in any language would be appreciated.

	Thanx

+-------------------------+--------------------------------+------------------+
|   Sven Axelsson         |  d83_sven_a@tekno.chalmers.se  |  DISCLAIMER:     |
|   dep:t of Linguistics  |          (^^ best ^^)          |                  |
|   univ. of Gothenburg   |        dlv_sa@hum.gu.se        |  This is not     |
|   SWEDEN                |      usdsa@seguc21.bitnet      |  a disclaimer.   |
+-------------------------+--------------------------------+------------------+

cep@apple.com (Christopher Pettus) (06/15/89)

The newly-released TN 238 describes the appropriate procedure, with
appropriate caveats; please e-mail me if you are interested in a (MS Word) copy.

-- Christopher Pettus                   | "Ganesha Said: 'Done!  The very 
   Network Systems Development          | day I was born I made my first
   Apple Computer, Inc.                 | mistake, and by that path have
   cep@apple.com   {nsc, sun}!apple!cep | I sought wisdom ever since.'"
   AppleLink: PETTUS.C                  | - The Mahabharata
   (408) 974-0004                       |   I: A Mine of Jewels and Gems

kent@lloyd.camex.uucp (Kent Borg) (06/15/89)

In article <819@tekno.chalmers.se> d83_sven_a@tekno.chalmers.se (Sven (Sciz) Axelsson) writes:
>I'm sure this has been out on the net before, but since I missed it then - 
>can someone please thell me how to get a file's full pathname given the
>information returned by SFGetFile?

Yes, it went by recently, and no, I didn't read it closely either,
BUT, I have just done it.  Not sure I did it the best way, but here it
is:

Call PBGetCatInfo a bunch of times.  You will have to fill in one of
those ugly parameter blocks, but each time you will get back in
ioDirParID the dirID of the parent directory.  Stuff that back into
ioDirID and call PBGetCatInfo again.  Keep calling until the parent is
1--you are now at the root.  Each time collect one more name in the
path in the string you supply via ioNamePtr.  Line the strings up in a
row and you have a path.  Now, what you can do with it I know less.

About *my* recent question of how to find out the directory of the
currently selected file in SFGetFile at hook time.  Yes, -1 *
SFSaveDisk is the volume and CirDirStore is the dirID.  That works.
What I don't know is a good way to get from there to opening the
currently selected file with OpenResFile.

The earlier paragraph indicates some of what I have been going
through.  Right now I am fighting with SetVol, trying to call it with
each name in the path as a partial path name.  I guess I could call it
once with the whole path--but I am afraid of the 255 character limit.
I am also looking into PBHSetVol wondering whether it will save me
some steps, but I suspect I need to somehow assure an open WD and on
and on...

I'm having fun.

Kent Borg
kent@lloyd.uucp
or
...!husc6!lloyd!kent