
On Tue, Apr 20, 2010 at 11:42 PM, Paul Moore <p.f.moore@gmail.com> wrote:
On 20 April 2010 17:47, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
I am not sure to follow the issue. Do you mean that in the same filesystem, each directory can treat case sensivity differently ? I wasn't aware of that.
Apologies, I was unclear (I was trying to avoid the term "filesystem" which isn't an obvious concept on Windows). Putting it more simply, you need to be able to determine the case sensitivity of the filesystem to determine if a file "has extension .xxx".
How would this affect the extension btw ? I can imagine that the path+extensions could to be normalized before the matching job, but I don't see other issue, do you have an example ?
As Mike Meyer explained, whether file foo.C "has extension .c" depends (as far as the user is concerned) on whether the filesystem it's on is case sensitive.
Many unix utility ports on Windows don't consider this, and they are quite annoying when the problem hits you (which admittedly isn't that often). Having an os.path.has_extension function in Python which doesn't consider case sensitivity would be an attractive nuisance, encouraging people to write subtly broken code like this. I'm -1 on such a function.
Having said that, if you can write a function which detects filesystem case sensitivity (and write a "correct" has_extension function based on it), you'd be my hero (I believe it's a pretty difficult issue, if not impossible in the general case).
Ok well, I doubt I'll be your hero, this is way over my head ;) The only simple way that comes in my mind is to write a test file to try it out but that's a hack But being able to detect it sounds like something we should definitely have in os/os.path.
Paul.
-- Tarek Ziadé | http://ziade.org