[Python-Dev] casefolding in pathlib (PEP 428)
larry at hastings.org
Fri Apr 12 23:15:13 CEST 2013
On 04/12/2013 10:05 AM, Guido van Rossum wrote:
> On Fri, Apr 12, 2013 at 1:39 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> I think we want glob("*.py") to find
>> "SETUP.PY" under Windows. Anything else will probably be surprising to
>> users of that platform.
> Yeah, I suppose so. But there are more crazy details. E.g. IIRC
> Windows silently ignores trailing dots in filenames. Do we want
> "*.py." to match SETUP.PY then?
Someone who is fresher than I am at Windows programming should answer
this, but AFAICT Win32 provides no API that will tell you if a
particular filename / volume is case sensitive. The VOLUME2 structure
from GetVolumeInfo doesn't report anything, and FindFirstFileEx provides
a special flag for you to tell the OS (!) whether or not you want
case-sensitive globbing. The closest I can get with my cursory browsing
of MSDN is that you could infer case-sensitivity from the filesystem
reported by GetVolumeInfo, but I doubt even that would be perfect.
My only suggestion: lob the problem back into the user's lap, perhaps
with something like
pathlib.cs['/'] = True
pathlib.cs['/mnt/samba-share'] = False
>> (long filenames appeared in Windows 95!).
That wasn't their first appearance; I'm pretty sure Windows NT 3.1
supported long filenames in 1992, and though I don't remember
specifically it's possible NT 3.1 also supported long and short
filenames for the same file. Windows 95 was the first appearance of
VFAT, the clever hack adding support for long and short filenames to FAT
More information about the Python-Dev