Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!apple!well!brecher From: brecher@well.UUCP (Steve Brecher) Newsgroups: comp.sys.mac.programmer Subject: Re: touching resource attributes w/o modifying file Keywords: mac resource manager setresattrs getresattrs Message-ID: <11508@well.UUCP> Date: 4 May 89 01:58:32 GMT References: <517@biar.UUCP> Reply-To: brecher@well.UUCP (Steve Brecher) Organization: Software Supply, Sunnyvale, CA Lines: 28 In article <517@biar.UUCP>, trebor@biar.UUCP (Robert J Woodhead) writes: > I have a couple of sections of code that occasionally need to temporarily > change resource attributes; in particular, resSysHeap. Basically, I want to > load a resource so I can look at it, but don't want it to go into the system > heap as that is 1) impolite and 2) can fail. > > getresattrs / setresattrs / my code / setresattrs(original) works fine, but > it has the side effect that it changes the file's modification date which I > don't really want to do; I want to be as non-invasive as possible. > > Therefore, any suggestions on how I can load to the application heap w/o > causing a modification in the file? There are a couple of ways to go. Before closing the file, you could call (in Pascal): SetResFileAttrs(refNum, BAnd(GetResFileAttrs(refNum), BNot(mapChanged))) The idea is to clear the mapChanged resource map attribute. You wouldn't need to call SetResAttrs(original) if you did this, as the map won't be written to disk. Or, you could bracket your entire operation with GetFileInfo/SetFileInfo. -- brecher@well.UUCP (Steve Brecher)