File::createLegalPathName bug with Windows paths


Please consider this code:


 It returns the string: C\Windows\, missing the colon. There's some special case for the colon in the function, but it is checked before quotes are removed, so it checks the wrong string position in this case.

A quick fix for me (or anyone else running into this) is to call unquoted on the string before passing it to createLegalPathName. However, I think this case should be handled correctly inside the function.


Hmm.. No, I don't think that's the responsibility of this function. A filename can actually contain quotes, so it's up to your own app to decide whether or not quotes should be removed, long before you get to the stage of calling this kind of method. When you get as far as using the File class, you're dealing with actual filenames, and it will assume that any quotes in there are because you want them in the name.