Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 23203 - [resources] Rename folder: Change of case fails
Summary: [resources] Rename folder: Change of case fails
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: 2.1   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 24166 27087 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-09-05 04:30 EDT by Channing Walton CLA
Modified: 2002-11-25 10:55 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Channing Walton CLA 2002-09-05 04:30:35 EDT
When renaming a folder by changing its case (e.g. foo to Foo) the error:
Could not create folder: [path to folder]/Foo

Channing
Comment 1 DJ Houghton CLA 2002-09-05 17:07:23 EDT
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.
Comment 2 Channing Walton CLA 2002-09-05 17:37:03 EDT
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
Comment 3 Channing Walton CLA 2002-09-06 03:30:32 EDT
I can confirm that the rename does actually rename the folder for me.

channing
Comment 4 Channing Walton CLA 2002-09-06 03:53:04 EDT
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
Comment 5 DJ Houghton CLA 2002-09-06 07:50:10 EDT
Did you follow the same steps?
Did you try and do another rename before the refresh?
Comment 6 Channing Walton CLA 2002-09-06 08:12:30 EDT
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
Comment 7 Channing Walton CLA 2002-09-06 08:25:42 EDT
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
Comment 8 John Arthorne CLA 2002-09-24 17:10:30 EDT
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.
Comment 9 Channing Walton CLA 2002-09-25 01:43:11 EDT
Excellent, thank you.
Comment 10 DJ Houghton CLA 2002-09-27 16:10:43 EDT
*** Bug 24166 has been marked as a duplicate of this bug. ***
Comment 11 Sonia Dimitrov CLA 2002-11-25 10:55:27 EST
*** Bug 27087 has been marked as a duplicate of this bug. ***