Xref: utzoo comp.sys.mac:26806 comp.sys.mac.programmer:4514 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!husc6!lloyd!kent From: kent@lloyd.camex.uucp (Kent Borg) Newsgroups: comp.sys.mac,comp.sys.mac.programmer Subject: Re: What's the "best" way to save a file? Message-ID: <328@lloyd.camex.uucp> Date: 15 Feb 89 15:37:24 GMT References: <1811@cps3xx.UUCP> Reply-To: kent@lloyd.UUCP (Kent Borg) Organization: Camex, Inc., Boston, Mass USA Lines: 44 In article <1811@cps3xx.UUCP> rang@cpswh.cps.msu.edu (Anton Rang) writes: >While watching all the discussion on the great Microsoft Word Save As >fiasco, I started thinking about the best way to do a "Save As" (or a >"Save", for that matter). It seems to me that the following is the >safest way to do it, if the file is going to be saved "on top of" an >existing file. > > 1. If doing "Save As", ask the user for the filename. > 2. Write out the new file, with some temporary name. > 3. Rename the "old file," if it exists, to a temporary name. > 4. Rename the new file to the old file's name. > 5. Delete the old file. I see two problems here: You will only be able to work with files that are less than half the size of your free disk space. Certainly if there is enough space for the double save, fine on this count, but what if there isn't? Not everybody has lots of empty disk space. Also, this scheme will not allow other applications to mess with your resource fork, everything over there will get blatted unless you copy it across from the old file. Why, you ask, should any other application be messing with other documents' resource forks?? Well, Projector, Apple's source code/documentation/whatever management system which is part of the new (beta) version of MPW does. It leaves info in a resource that tells it what revision the file is, where it came from, who checked it out, etc. Should Apple be doing this? Why not? Your scheme also will not work if you are messing with some other application's document. Say you understand TEXT documents, that doesn't mean you know about all the resources that might accompany a document produced by unknown creator (window and scroll position, font choice and size, etc.) Seems you must adjust your scheme to preserve any resources that were in the original file. Kent Borg kent@lloyd.uucp or hscfvax!lloyd!kent or kent%lloyd@hscfvax.harvard.edu