Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bu.edu!rpi!zaphod.mps.ohio-state.edu!usc!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: Help With File Manager Message-ID: <48193@apple.Apple.COM> Date: 17 Jan 91 02:13:42 GMT References: <3087.2794333E@blkcat.fidonet.org> Organization: Apple Computer Inc., Cupertino, CA Lines: 36 Ken.Knight@f421.n109.z1.fidonet.org (Ken Knight) writes: >lasky@iris.ucdavis.EDU (Ty Lasky) Asks: >>1. If I am using SFGetFile to allow the user to select a file, then I >>believe I have the name and the volume reference number (or is it the >>working directory ID?). Now, how do I get the volume name? > >SFGetFile() gives you a volume reference number. What you then need is >the working directory ID which you can get with a call to GetWDInfo(). >Like this: > err = GetWDInfo(0,&(reply.vRefNum),&dirID,&procID); > if (err == noErr) { > err = HOpen(reply.vRefNum,dirId,reply.fName,permission,refNum); > .... /* Permission is the read/write access to want for the file. */ > .... /* do you thing. */ > } Actually SFGetFile() returns a working directory reference number. To get the volume reference number, you can either call err = GetVRefNum(reply.vRefNum,&volumeRefNum); [high-level only] or pb.ioNamePtr = nil; pb.ioVRefNum = reply.vRefNum; // working directory refNum pb.ioVolIndex = 0; err = PBHGetVInfo(&pb,false); volumeRefNum = pb.ioVRefNum; // volume reference number steve -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Steve Christensen | Apple Computer, Inc. | Disclaimer: | 20525 Mariani Ave, MS-81CS | the above may be stevec@apple.com | Cupertino, CA 95014 | a lie...or not.