Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [stellation-res] File.renameTo()

On Saturday 24 August 2002 12:42 pm, Jonathan Gossage wrote:
> This API is not safe to use on any platform. It will never succeed when a
> move across file system boundaries is required (e.g. between a local file
> system and NFS) and on Windows it will fail when trying to move a file from
> one directory to another. The failure is reported, not by an exception, but
> simply by returning "false".

I knew about the filesystem restriction, but not the windows restriction.

We didn't consider the filesystem restriction to be a big deal. Since the 
workspace is created and maintained by Stellation, it shouldn't ever
be crossing filesystems. So moving things around within the workspace
should never cause a problem.

Windows is a different situation apparently.

> One solution would be to use the Unix mv command, natively under Unix and
> under Cygwin under Windows. Another, and I feel better solution, would be
> to implement an internal method that provides the necessary subset of
> functionality of the mv command.

One solution would be to replace the File.rename with a copy to
the new location, and delete from the old. 

> Specifically this one bit me in TextArtifact.normalize(). It is nasty
> because the workspace file simply disappears and later processing fails
> with a FileNotFound exception because the workspace file is no longer
> present.

Why did rename bite you in normalize?

	-Mark

-- 
Mark Craig Chu-Carroll,  IBM T.J. Watson Research Center  
*** The Stellation project: Advanced SCM for Collaboration
***		http://www.eclipse.org/stellation
*** Work Email: mcc@xxxxxxxxxxxxxx  ------- Personal Email: markcc@xxxxxxxxxxx




Back to the top