Personally, I tried every hack I could in the past to make File.renameTo
work completely reliably, and could never quite do it. I even resorted
to trying things like calling File.renameTo up to three times in a row
with a 50 ms pause in between each call. At the end of the day, the only
truly reliable solution I could come up with was to manually copy the
contents of one file from one place to another.

Regards,
Matt

> -----Original Message-----
> From: petite_abeille [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, February 18, 2003 5:13 PM
> To: Lucene Developers List
> Subject: Re: FSDirectory patch for file renaming
> 
> 
> 
> On Tuesday, Feb 18, 2003, at 22:59 Europe/Zurich, Matt Tucker wrote:
> 
> > I believe that's the current logic used by FSDirectory, and 
> it still 
> > breaks.
> 
> I see... deleting an non-existent file before a rename 
> usually does the 
> trick under the different Windows flavors...
> 
> If the destination file exists in the first place... have you 
> tried to 
> simply recreate the File object after the first delete if the 
> file did 
> exists? Something like:
> 
> // aDestinationFile exists in this case... get ride of it...
> 
> aDestinationFile.delete();
> 
> // FIXME: Hack to flush something, somewhere in the vm... sigh...
> 
> aDestinationFile = null;
> aDestinationFile = new File( aPath ); aDestinationFile.delete();
> 
> // Finally do the rename...
> 
> aSourceFile.renameTo( aDestinationFile );
> 
> PA.
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to