improve UNC path handling (#2126)

always call 'abspath()' on the directory path to handle cases when the
current working directory is UNC and 'base-directory' is relative.
This commit is contained in:
Mike Fährmann
2021-12-30 22:22:19 +01:00
parent 47eae4c393
commit 3b7c7daa76
3 changed files with 5 additions and 2 deletions

View File

@@ -178,10 +178,11 @@ class PathFormat():
if WINDOWS:
# Enable longer-than-260-character paths
directory = os.path.abspath(directory)
if directory.startswith("\\\\"):
directory = "\\\\?\\UNC\\" + directory[2:]
else:
directory = "\\\\?\\" + os.path.abspath(directory)
directory = "\\\\?\\" + directory
# abspath() in Python 3.7+ removes trailing path separators (#402)
if directory[-1] != sep: