[
https://issues.apache.org/jira/browse/IO-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12606815#action_12606815
]
Sam Berlin commented on IO-171:
-------------------------------
I just happened to stumble across this issue, and have no idea if this comment
is relevant, but...
The default FS on OS X has its own quirks. It is case preserving, but only
partially case insensitive (from Java's eyes atleast). Consider this:
// Assume no file named 'Foo', 'foo', or any variation exists on disk
File a = new File("foo");
File b = new FIle("Foo");
a.equals(b); // FALSE
a.getCanonicalFile().equals(b); // False
b.createNewFile(); // create 'Foo'
a.getCanonicalFile().equals(b); // True -- because 'a' returned 'Foo' from
getCanonicalFile
b.getCanonicalFile().equals(a); // False -- because 'a' is still 'foo'
Basically, File.equals essentially looks at String.equals of the filename. If
you want to see if the file exists on disk, you have to use getCanonicalFile,
but that only works if there's a file on disk it can canonicalize to.
(FWIW, this is all going off memory of workarounds I've had to implement
because of the quirks.)
> IO assumes there are only two OSes: Windows and Unix
> ----------------------------------------------------
>
> Key: IO-171
> URL: https://issues.apache.org/jira/browse/IO-171
> Project: Commons IO
> Issue Type: Bug
> Reporter: Sebb
> Priority: Minor
>
> Just noticed that IO assumes systems are either:
> Windows-like:
> * File.separatorChar = \
> * Case-insensitive matching
> or
> Unix-like:
> * File.separatorChar = /
> * Case-sensitive matching
> It may well be true that there are only two different file sepator
> characters, but it is not true that all non-Windows systems use
> case-sensitive matching.
> For example, OpenVMS uses a file separator char of /, but originally only
> supported case-insensitive file names (always shown as uppercase).
> Current versions of OpenVMS support both upper and lower-case; the default is
> to use case-insenstive matching (and upper case names).
> Perhaps the IOCase.SYSTEM constant needs to have an "Unknown" or "Variable"
> setting for this; it would then be an error to use IOCase.SYSTEM to determine
> the case sensitivity.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.