Xref: utzoo comp.sys.mac:26711 comp.sys.mac.programmer:4474 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucdavis!iris!lim From: lim@iris.ucdavis.edu (Lloyd Lim) Newsgroups: comp.sys.mac,comp.sys.mac.programmer Subject: Re: What's the "best" way to save a file? Message-ID: <3665@ucdavis.ucdavis.edu> Date: 14 Feb 89 08:04:24 GMT References: <1811@cps3xx.UUCP> Sender: uucp@ucdavis.ucdavis.edu Reply-To: lim@iris.ucdavis.edu (Lloyd Lim) Distribution: na Organization: U.C. Davis - Department of Electrical Engineering and Computer Science Lines: 51 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. > > The "old file" is the existing file; the "new file" is the one just >being saved. The advantage of doing this is that the old file isn't >removed until the new file has been successfully written. The >disadvantage is that you can't use "Save As" to free up disk space by >saving on top of an existing file. > What do people think of this idea? What are the biggest problems >you see with it? I just finished working on a major Mac product recently. The scheme you describe is almost exactly the scheme we used. The only other addition is that if there isn't enough disk space to save the temporary copy, the old file is deleted first. Thus, there really aren't any disk space problems when space is tight although saving is not quite as safe. What is the biggest problem? A big one from the user's point of view. When you do a save in this manner, the new file gets a new icon position which is different from the original file's icon. I forget the details but for some reason the usual File Manager calls for setting the Finder info don't work correctly. Anyways, every time you save a file, it's icon moves. This is the worst when your file icon is on the desktop and you're using MultiFinder. When you save the file, it's icon disappears (!) because the new file's icon is displayed inside the folder that the original file belonged to. This is very disconcerting to the user that doesn't know what is happening. A problem, of course, but we felt it was more important to have safer file saving. Mac DTS couldn't provide us with any solutions that would not break under the next System/Finder release. BTW, there is a solution that does solve this problem but it doubles the file saving time (which is very unacceptable in most cases). You can save the new contents right on top of the original file after saving a copy as described above or making a duplicate of the original. To repeat, this method is sloooow. +++ Lloyd Lim Internet: lim@iris.ucdavis.edu Compuserve: 72647,660