A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-April/125291.html below:

[Python-Dev] casefolding in pathlib (PEP 428)

[Python-Dev] casefolding in pathlib (PEP 428) [Python-Dev] casefolding in pathlib (PEP 428)Ralf Schmitt ralf at systemexit.de
Fri Apr 12 19:42:25 CEST 2013
Guido van Rossum <guido at python.org> writes:

> Actually, I've heard of code that dynamically falls back on short
> names when paths using long names exceed the system limit for path
> length (either 256 or 1024 IIRC). But short names pretty much require
> consulting the filesystem, so we can probably ignore them.

The limit is 260 characters. But longer paths can be handled by
prepending \\?\ and using the unicode APIs.

see http://msdn.microsoft.com/en-us/library/aa365247.aspx#maxpath

we have the following code to handle the above insanity:
,----
| def prepend_magic_win32(path):
|     assert isinstance(path, unicode), "path must be of type unicode"
| 
|     if path.startswith(u"\\\\"):
|         if path.startswith(u"\\\\?\\"):
|             return path
|         else:
|             return u"\\\\?\\UNC\\" + path[2:]
|     else:
|         return u"\\\\?\\" + path
`----

-- 
Cheers
Ralf
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4