levin@bbn.com (Joel B Levin) (09/07/88)
I would like to read a resource out of the Desktop file. Unfortunately, under multifinder it is always open and OpenResFile always returns error -49. (This is not a problem if I do this in an application without MF.) I know the file can be read by other means (MPW can duplicate the Desktop file while Finder has it open, for example) and there is some discussion in IM4 about how to refer to an open file for "regular" file I/O. Question: if I want to be able to read the resource at any time, must I thus write code to read the resource fork and manually locate and read the resource, simulating what GetResource et al do? I note by the way that ResEdit doesn't attempt to solve this problem. Thanks / JBL UUCP: {backbone}!bbn!levin POTS: (617) 873-3463 INTERNET: levin@bbn.com
bob@eecs.nwu.edu (Bob Hablutzel) (09/07/88)
> I would like to read a resource out of the Desktop file. > Unfortunately, under multifinder it is always open and OpenResFile > always returns error -49. Try using _OpenRFPerm instead of _OpenResFile. It will allow you to specify the read/write access you want for the file, and can return the RefNum of a file already open. (See IM IV-17 for more information) Bob Hablutzel BOB@NUACC.ACNS.NWU.EDU
lsr@Apple.COM (Larry Rosenstein) (09/07/88)
In article <29389@bbn.COM> levin@BBN.COM (Joel B Levin) writes: >I would like to read a resource out of the Desktop file. >Unfortunately, under multifinder it is always open and OpenResFile >always returns error -49. (This is not a problem if I do this in an You can open it read-only using OpenRFPerm (Inside Mac volume 4). This is not available on 64K ROM machines, however. The danger is that the Finder will still have the Desktop file open read-write and therefore there are 2 copies of the resource map in memory. If the Finder changes the desktop file (which changes the location of resources on the disk) then your copy of the resource map will be invalid. You can minimize the danger by opening the file only when you need it. Unfortunately the Desktop file can be large and opening it can take a couple of seconds. Larry Rosenstein, Object Specialist Apple Computer, Inc. 20525 Mariani Ave, MS 46-B Cupertino, CA 95014 AppleLink:Rosenstein1 domain:lsr@Apple.COM UUCP:{sun,voder,nsc,decwrl}!apple!lsr