dotbot
dotbot copied to clipboard
Windows symlinks are always recreated
On Windows, os.readlink() returns a UNC path that never matches the anticipated symlink destination. This causes dotbot to always recreate the links (example dotbot output below):
Incorrect link ~/.gitconfig -> \\?\C:\Users\Me\Documents\dev\dotfiles\gitconfig
I tested two possible fixes:
- Use
os.path.realpath()instead ofos.readlink() - Conditionally remove the
\\?\prefix when dotbot is running on Windows.
Option 1 results in a unit test failure:
[42/55] (link-relink-relative-leaves-file.bash)
relink relative does not incorrectly relink file
- test failed.
-> fail!
Therefore I recommend going with option 2, which gives expected results (example dotbot output below):
Link exists ~/.gitconfig -> C:\Users\Me\Documents\dev\dotfiles\gitconfig