Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!ucdavis!iris!rogers From: rogers@iris.ucdavis.edu (Brewski Rogers) Newsgroups: comp.sys.amiga.tech Subject: Re: Is there a routine to generate full-path names? Summary: yes Message-ID: <6522@ucdavis.ucdavis.edu> Date: 22 Jan 90 03:10:29 GMT References: <1271.AA1271@noel> Sender: uucp@ucdavis.ucdavis.edu Reply-To: rogers@iris.ucdavis.edu (Brewski Rogers) Organization: U.C. Davis - Department of Electrical Engineering and Computer Science Lines: 111 In article <1271.AA1271@noel> greg@noel.CTS.COM (J. Gregory Noel) writes: >I badly need a routine that will convert an arbitrary path name into its >equivalent full-path name. That is, I need a routine that will take a >name like "SYS:C" and return "System:1.3/C" if that is where the directory >actually is. It would be handy if the routine also converted "DF0:name" >into "Volume:name" of the volume currently in DF0, but that's not essential. > .. >Many thanks, >-- >-- J. Gregory Noel, UNIX Guru greg@noel.cts.com or greg@noel.uucp I had the same problem a couple of weeks ago. Here's the source. and it does return the volume name, not the device name. enjoy - Bruce /*!******************************************************************* * FindRoot by Bruce Rogers 1/20/90 *********************************************************************/ #include #include #include #define MAXPATHSTRING 140 void *AllocMem(); char absDir[MAXPATHSTRING]; char absDirName[MAXPATHSTRING]; /*!******************************************************************* * Kludges disk:name/directory with filename so we can just read it. *********************************************************************/ void DosConcatenate(string1,string2,result) char string1[],string2[],result[]; { short i,j; for(i=0; string1[i] != '\0'; i++) result[i]=string1[i]; if ((result[i-1] != ':') && (result[i-1] != '/') && (i!=0) && string2[0]!=0) { result[i]='/'; ++i; } for(j=0; string2[j] != '\0'; j++) result[i+j] = string2[j]; result[i+j] = '\0'; } /*!******************************************************************* * Recursively go up parent chain, looking for oldest parent. * Create the absolute path string as we go. *********************************************************************/ SeekRoot(lock) ULONG lock; { short i; struct FileInfoBlock *fileInfo; fileInfo=AllocMem(sizeof(struct FileInfoBlock),0); Examine(lock,fileInfo); DosConcatenate(fileInfo->fib_FileName,absDirName,absDir); for(i=0;i