On Mon, Mar 2, 2009 at 4:00 PM, Niklas Gustavsson <nik...@protocol7.com> wrote: > On Mon, Mar 2, 2009 at 11:01 AM, Emmanuel Lecharny <elecha...@apache.org> > wrote: >> Nah, i'm wrong. I'm confusing the two issues : the socket error and the case >> sensitive directory error. > > Damn. Okay, think out loud, could we do an equals implementation that: > > 1. Check if equals return true, if so, return true > 2. Else, check if File.getName() is equal ignoring case. If not, > return false (this is just an optimization to skip the remaining steps > for most cases) > 3. Check if File.exists() returns true for both casings > 4. Do a file listing on the parent, if we get exactly one match on the > file name (case insensitive matching), we return true > 5. Else return false
Can't we create the name like File file = new File("FiLe"+System.currentTimeMillis()); check if it exists. Chance are very rare that it will. If it exist recreate a new file name. If it doesn't exist, we call file.createNewFile(); and do the case sensitive stuff. I doubt it has made life simple :-( > > Would that work? Step 4 would mean taking a performance penalty if > there are lots of files in the parent directory, but it should not be > a very common case. I hope, we would be doing this once, to establish if File System is case sensitive or not. So performance shouldn't really be a big cause.