Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!sdd.hp.com!decwrl!orc!olivea!apple!apple.com!nmday From: nmday@apple.com (Neil) Newsgroups: comp.sys.mac.programmer Subject: Re: Launching application returned in an SFReply record. Message-ID: <9816@goofy.Apple.COM> Date: 17 Aug 90 19:20:14 GMT References: <25810@cs.yale.edu> Sender: usenet@Apple.COM Distribution: usa Organization: Apple Computer, Inc. Lines: 57 -- Is there any function hidden in IM somplace that returns a full -- path name given an SFReply? There is no toolbox routine to return a full path name, but doing it yourself is fairly easy. Here is a C routine to do it (gleaned from some DTS sample code)... /* **pathName (dirID,vRefNum,s) **returns a string containing the full pathname to the current file or directory **this code is snached from the DTS sample code StdFile.c (but slightly modified). **Added support for both files and directories. Don't give a flying *#@! if it **breaks under A/UX, thank you very much.... */ char *pathName(dirID,vRefNum,s) long dirID; short vRefNum; char *s; { OSErr err; /* error container */ CInfoPBRec block; /* infoBlock to be used CatInfo calls */ Str255 directoryName; /* a place to stuff my directory name */ *s = 0; block.dirInfo.ioNamePtr = &directoryName; block.dirInfo.ioDrParID = dirID; do { block.dirInfo.ioFDirIndex = -1; /* Specify vRefNum and DirID for call */ block.dirInfo.ioVRefNum = vRefNum; /* set the ParamBlock's vRefNum */ block.dirInfo.ioDrDirID = block.dirInfo.ioDrParID; /* set the ParamBlock's DirID */ err = PBGetCatInfo (&block,false);/* get information on catalogue */ if (err) break;/* get me outta here...... */ pStrcat (&directoryName,"\p:");/* add a colon to the begining... */ pStrcat (&directoryName,s);/* prepose newly found directory name */ pStrcpy (s,&directoryName);/* swap the two */ } while (block.dirInfo.ioDrDirID != fsRtDirID);/* loop till we hit the root */ return (s);/* cough up the result */ } Hope that was helpfull. Neil Day The oppinions presented above are my own - any resemblance to those of Apple Computer are purely coincidental.