[Python-ideas] PEP 428 - object-oriented filesystem paths

Stephen J. Turnbull stephen at xemacs.org
Thu Oct 11 07:53:12 CEST 2012


Ronald Oussoren writes:

 > All in all the best we seem to be able to do is use the OS as a
 > heuristic, most Unix filesystems are case sensitive while Windows
 > and OSX filesystems are case preserving.

We can do better than that heuristic.  All of the POSIX systems I know
publish mtab by default.  The mount utility by default will report the
types of filesystems.

While a path module should not depend on such information, I suppose[1],
there ought to be a way to ask for it.

Of course this is still an heuristic (at least some Mac filesystems
can be configured to be case sensitive rather than case-preserving,
and I don't think this information is available in mtab), but it's far
more accurate than using only the OS.

Footnotes:
[1]  Requires a system call or subprocess execution, and since mounts
can be dynamically changed, doing it once at module initialization is
not good enough.



More information about the Python-ideas mailing list