- From: Jeff Dripps <jeff@macalot.com>
- Date: Tue, 9 Jul 1996 11:34:54 -0400
- To: www-jigsaw@w3.org
>Jeff Dripps writes: > > > > Problem #1: It appears that Jigsaw manages data files by first creating a > > temporary file (with a .tmp extension), then after updating the file > > contents, attempts to rename the file to the desired name. The problem is, > > at least on macintosh, this fails to occur for some reason. After > > exercising Jigsaw, I find various files scattered about, such as > > realms.db.tmp, admin.db.tmp and many .jigidx.tmp files. It appears that > > Jigsaw could not rename them for some reason (possibly because they are > > open?). In any event, this does not appear to be due to a duplicate file > > name, as in many cases there was no such file. > >File renaming is one (and the only) place that I had to change to make >it work similarly on Unix and Windows. It moght be the case that it >needs another fix on the mac. The best way to solve this problem would >be to compile a simple program that uses the File.rename method, and >see how it performs (eg instead of running your system rename, write a >program that does File.rename and see how it goes). It might also be a >Java-mac bug (?) > >This is the one I used on windows (from memroy) I added a couple of newbie error checks to your suggested test code (below), changed 'from.rename' to 'from.renameTo', (which is what I think you meant) and ran it. Assuming that the source (from) file should be present and the destination (to) file should not be, the output each time was: 'rename "one" to "two" failed !' and I was never able to rename a file. I tried specifying full paths, file name only, all to no avail. Does this mean that the File rename method in the Java runtime on mac is broken? Geez I hope not! If so, could you provide a sample of just how this could be overcome? i.e., would I need to extend the File class in order to add a new ReNameTo method, then recompile Jigsaw using the new renamew method?? Any help appreciated. sinc, -jeff ****************************************************************************** import java.io.*; public class Rename { public static void main(String args[]) { try { System.out.println("Running Rename..."); File from = new File(args[0]); File to = new File(args[1]); if (! from.exists() ) System.out.println("from file does not exist!"); if (! to.exists() ) System.out.println("to file does not exist!"); if ( ! from.renameTo(to) ) System.out.println("rename "+from+" to "+to+" failed !"); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Rename <from> <to>"); } } }
Received on Tuesday, 9 July 1996 11:35:07 UTC