Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!apple!usc!ucsd!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: INIT getting it's file name... Message-ID: <8831@hoptoad.uucp> Date: 28 Oct 89 06:15:14 GMT References: <56505@tiger.oxy.edu> <4020@helios.ee.lbl.gov> <5511@umd5.umd.edu> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Distribution: usa Organization: Eclectic Software, San Francisco Lines: 27 One: This is largely a philosophical/aesthetic quibble, but really, you shouldn't write into code files if you can help it. It's better to use an external preferences file. Not only does this preserve a valuable dichotomy between code and data, but it allows the user to independently throw away the user/run-time settings or the code, instead of having to discard or regenerate both at once. Two: If you want to allow renaming without file ids, the best way to do it is generally to use the creator longword. You can almost trivially write code to loop over all files in the system folder until it encounters one with your unique creator longword and the appropriate file type, then use that. This completely bypasses the file name, and works both under System 7.0 and earlier systems. In practice, it's also fast enough unless you're doing very frequent updates. I don't think you'd want to use this if you were writing the file 60 times a second; then again, you don't want to do an OpenResFile, WriteResource, CloseResFile every 60th of a second either! Three: I have always felt that the ability to rename INITs is overrated. I mean, who cares if you can or not? However, few people agree with me on this. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "`Truth' never set anyone free. It is only *doubt* which will bring mental emancipation." -- Anton LaVey, quoted by Arthur Lyons, SATAN WANTS YOU