Steve Dower added the comment:
Paths prefixed with "\\?\" also need to be normalized, not just absolute. AFAIK
there are no official docs on what normalization is required, but it includes
at least trimming trailing dots on directory names, removing "." and ".."
sections, adjacent backslashes, and removing trailing spaces on any segment.
Without this, you will access/create/etc. files that users cannot otherwise see
or modify.
I don't disagree that we should add the prefix for long paths, but we need to
at least get most of the normalization correct so that cases like this work:
>>> open('C:\\Dir \\file.txt.', 'r').read()
"Content"
>>> open('\\\\?\\C:\\Dir \\file.txt.', 'r').read()
FileNotFoundError: [Errno 2] No such file or directory: '\\\\?\\C:\\Dir
\\file.txt.'
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18199>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com