Looking at case insensitivity - question
Alexander Belchenko
bialix at ukr.net
Wed Apr 16 08:49:20 CDT 2008
Paul Moore пишет:
> I'm looking at how Mercurial handles case-insensitivity issues, with
> the hope of fixing some of the bugs in this area. However, one thing
> I'm finding is that I need to identify the actual filename in the
> filesystem, given a name which matches it, but may differ in case.
>
> I can write a function to do this, but I think it needs to be
> expensive (walk up the filename, doing os.listdir at each level, to
> get the correct case for the name).
It's the wrong way to using os.listdir for this. It will be slow slow slow.
You should consider to look at Win32 API FindFirstFile, FindNextFile, FindClose.
pywin32 package contains wrapper around this API, look at win32file.FindFiles
But you can write your own wrapper of course.
More information about the Mercurial
mailing list