Community
Participate
Working Groups
When renaming a folder by changing its case (e.g. foo to Foo) the error: Could not create folder: [path to folder]/Foo Channing
org.eclipse.core.internal.resources.ResourceTree.standardMoveFolder This method has a call in it which basically renames the folder in the file- system and then does a java.io.File.exists() on the destination to ensure that it was moved ok. Then it does another exists() check on the source to see if it still exists and since it does (presumably java.io.File.exists() is case- insensitive), it returns a failure code. Note that if you do a refresh on your project in the Navigator, since the file case was really changed on disk it will be updated with the correct casing.
I'll try the refresh after the rename. I believe that Java relies on the underlying file system (in this case NTFS which is case preserving but case insensitive) when it looks for files, hence the error. I guess its a special case that has to be coded for :-( Channing
I can confirm that the rename does actually rename the folder for me. channing
I've just had a different error pop up when I tried to rename a folder: 'A resource exists with a different case: /project path/Foo' In this case the folder was not renamed. Channing
Did you follow the same steps? Did you try and do another rename before the refresh?
Hi, yes I did exactly the same thing. I should explain more... we have a package 'com.x.y.fooBar' (note the uppercase), and it lives in the appropriate directory /com/x/y/fooBar. It is checked in to CVS. But, the Java in the package has package statements that read package 'com.x.y.foobar' (note the lower case). Of course the compiler barfs. I was trying to fix this when I experienced the trouble. Channing
I have figured out what is happening. CVS thinks the path is com.x.y.fooBar. If I rename it to com.x.y.foobar the error is "A resource exists with a different case", and the folder is not renamed. If I go the other way, from com.x.y.foobar to com.x.y.fooBar, the error is "Could not create folder com.x.y.fooBar", but the folder is renamed. Channing
Released a fix. If the FS is not case sensitive and the source and destination differ only in case, I omit the source.exists() check. The reasoning is that since the destination exists, and the FS does not tolerate two files that differ only in case, then it is not possible that the source still exists so the check isn't needed.
Excellent, thank you.
*** Bug 24166 has been marked as a duplicate of this bug. ***
*** Bug 27087 has been marked as a duplicate of this bug. ***