Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!bionet!synoptics!unix!mxmora From: mxmora@unix.SRI.COM (Matt Mora) Newsgroups: comp.sys.mac.programmer Subject: Re: Pathname to wd ? Message-ID: <12851@unix.SRI.COM> Date: 6 Jun 90 18:59:39 GMT References: <1234600036@uxa.cso.uiuc.edu> <8572@goofy.Apple.COM> Reply-To: mxmora@unix.UUCP (Matt Mora) Organization: SRI International, Menlo Park, CA Lines: 53 In article <8572@goofy.Apple.COM> enwall@apple.com (Tim Enwall) writes: >In article <1234600036@uxa.cso.uiuc.edu> ews00461@uxa.cso.uiuc.edu writes: >> How can I convert a full path name to a working directory refnum ? > >Eric, > >I don't know off-hand how to accomplish this. Pretty much there are only >a few routines I know of which RETURN a wdRefNum. Most now return the >real vRefNum. > [stuff deleted] >Tim Enwall, This might help a bit but might not be exactly what you want. Its from page 118 of UMPG The original posting was from Tim Maroney. And on the theory that you might want to convert the name back some day, here's a routine I use for that. Notice that it will actually create the directory if it doesn't exist now. If this isn't what you want, throw away the error recovery code. FullToFolder(StringPtr name, short *volume, long *folder) { CInfoPBRec dirInfo; HVolumeParam hvp; short i; dirInfo.dirInfo.ioNamePtr = name; dirInfo.dirInfo.ioDrDirID = 0; dirInfo.dirInfo.ioVRefN.dirInfo.ioResult == dirNFErr) { dirInfo.dirInfo.ioNamePtr = (StringPtr)name; dirInfo.dirInfo.ioDrDirID = 0; dirInfo.dirInfo.ioVRefNum = 0; if (PBDirCreate((HParmBlkPtr)&dirInfo, false) == = dirInfo.dirInfo.ioDrDirID; } else { *volume = 0, *folder = 0; return dirInfo.dirInfo.ioResult; } } else { *volume = 0, *folder = 0; return dirInfo.dirInfo.ioResult; } return noErr; } -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com -- ___________________________________________________________ Matthew Mora SRI International mxmora@unix.sri.com ___________________________________________________________