Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!ox.com!heifetz!tbomb!time From: time@ice.com (Tim Endres) Newsgroups: comp.sys.mac.programmer Subject: Re: I want to write Add1ResMenu() Date: Thu, 18 Apr 91 14:41:35 EST Organization: ICE Engineering, Inc. Message-ID: <1CE00001.ddgajp2@tbomb.ice.com> Reply-To: time@ice.com X-Mailer: uAccess - Mac Release: 1.1.b1 Lines: 27 In article <1991Apr18.002228.25647@umbc3.umbc.edu>, cs483106@umbc5.umbc.edu (cs483106) writes: > I don't know if it's sanctioned or not, but I have a simple technique for > finding out if a resource file is open or not. Simply do an OpenRF on the file > in question. If the resource file is open, then the Resource manager will have > write access to the file, and you will not be able to open it(you will get > an error). If the file isn't open, you can get access. Just remember to do > an FSClose if you do get access, and you're all set. > (note that this could fail when trying to open something that's on a server. > If another machine, also attached to the server, were to do an OpenResFile > in between your OpenRF and your OpenResFile, you could think the file was > available, but then get an error when you try to open it. No big thing, in > most cases.) This could be dangerous, as a file opened as READONLY might succeed. It is simpler to do a PBGetFInfo(). The ioFlAttrib flags will tell if either or both forks are open and which. tim. ------------------------------------------------------------- Tim Endres | time@ice.com ICE Engineering | uupsi!ice.com!time 8840 Main Street | Voice FAX Whitmore Lake MI. 48189 | (313) 449 8288 (313) 449 9208