I came across this issue couple of weeks back and can be generated on 1.39, 1.45 and 1.46(released version, didn’t try it on the svn version)
If I created a two file object
juce::File file1(T("/Users/vishvesh/Desktop/2.pdf"));
juce::File file2(T("/Users/vishvesh//Desktop///2.pdf"));
if (file1.operator== (file2)) // this condition fails, although physical they are same file
juce::Logger::outputDebugString("same files");
if (file1.operator!= (file2)) // this condition fails, although physical they are same file
juce::Logger::outputDebugString("same files");
I do understand, that in the documentation for these methods you mention
But don’t you think, these methods would be better served if they check if both the file objects are of the same file, rather than checking the file path.
Well, if you’re feeding it crazy paths like that, I’m not surprised that you’re getting strange results! I think a sensible change might be to make sure the File class corrects any double-slashes when the it first gets the path, rather than to change the comparison code…
Anyone know what the “official” view is about double-slashes in file paths? If the OSes consider it legal for a path to contain them, then I should probably make the File class strip them out…