[Python-Dev] os.path.normcase rationale?

Dirkjan Ochtman dirkjan at ochtman.nl
Sun Sep 26 14:02:48 CEST 2010


On Sun, Sep 26, 2010 at 13:36, Paul Moore <p.f.moore at gmail.com> wrote:
> Hmm, I can't find the one I was thinking of. GetLongFileName correctly
> sets the case of all but the final part, and FindFile can be used to
> find the last part, but that's not what I recall.
>
> GetFinalPathNameByHandle works, and is documented to do so, but (a) it
> works on an open file handle, so you need to open the file, and (b)
> it's Vista and later only...

FWIW, here's what Mercurial uses to get the real path name on Windows:

http://hg.intevation.org/mercurial/crew/file/66a07fb76ceb/mercurial/util.py#l633

(I don't know much about that code or this topic, but maybe someone
finds it useful. It doesn't use any "special" Windows API, so if there
is any, it's something the hg hackers don't know about.)

Cheers,

Dirkjan


More information about the Python-Dev mailing list