Niklas Gustavsson wrote:
On Fri, Feb 27, 2009 at 12:04 PM, Emmanuel Lecharny
<elecha...@apache.org> wrote:
Files are considered as different.
This makes our task somewhat harder :-) So, on OS X, if we got a
directory (or file I assume) called "foo", the following will be
correct, right?
new File("foo").equals(new File("FOO")) => false
Correct
new File("FOO").delete() => true
correct
Given a file name which might not be in the correct casing, is there a
way to detect the "real" casing in HSF+? For example, what would the
following return?
new File("FOO").getName()
new File("FOO").getAbsolutePath()
new File("FOO").getCanonicalPath()
new File("FOO").getPath()
The name is kept. You will have FOO for all those guys.
Now, to detect if the underlying FS is case insensitive, I found that
doing something like :
File f1 = new File( "test" );
File f2 = new File( "TEST" );
if ( !f1.equals( f2 ) ) {
if ( f1.createNewFile() != f2.createNewFile() ) {
// Case insensitive but name preserving
} else {
// case sensitive
}
} else {
// case insensitive
}
Maybe someone else has a better idea ?
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org