mirror of
1
0
Fork 0

Resolve Windows symlinks correctly

On Windows, `os.readlink(path)` returns UNC paths that start with `\\?\`.
The UNC prefix can be removed when running on Windows.

Fixes #307
This commit is contained in:
Kurt McKee 2022-04-11 08:31:16 -05:00
parent 5f6d060fd2
commit 41778119a4
1 changed files with 4 additions and 1 deletions

View File

@ -196,7 +196,10 @@ class Link(dotbot.Plugin):
Returns the destination of the symbolic link.
"""
path = os.path.expanduser(path)
return os.readlink(path)
path = os.readlink(path)
if sys.platform[:5] == "win32" and path[:4] == "\\\\?\\":
return path[4:]
return path
def _exists(self, path):
"""