[Python-ideas] Small enhancement to os.path.splitext
Mike Meyer
mwm-keyword-python.b4bdba at mired.org
Tue Apr 20 19:11:01 CEST 2010
On Tue, 20 Apr 2010 18:47:50 +0200
Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> > (Of course, if you want to start down this route, I'd suggest you
> > start with a function which, given a directory name, determines if
> > that directory's treats file names within it as case sensitive or not.
> > I'm not even sure if this is possible to implement in any sane way,
> > but it would be the key building block for any other path matching
> > code, such as your os.path.hasext proposal).
>
> 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.
I don't think so. On the other hand, with modern file systems, if I
need a directory that is case-insensitive on a file system that's
case-sensitive, I'll just create a case-sensitive file system at that
point. Doesn't even require root privs these days.
> 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 ?
This gets back to user expectations - if foo.c and foo.C are different
files, then foo.c doesn't have a .C extension. If they aren't
different file, then it does. Which means you have to know whether
files are being treated in a case insensitive manner or not before you
can normalize the names.
<mike
--
Mike Meyer <mwm at mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
More information about the Python-ideas
mailing list