diff options
author | Bert Belder <bertbelder@gmail.com> | 2018-07-21 03:52:00 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-07-21 13:04:11 -0400 |
commit | 709b0cb90cec938cbfd3d49ed1c35fa949bda36a (patch) | |
tree | 65679a7bcd1f4896acafecf22b2ca49858c3395f /tools/util.py | |
parent | 5d1cb542617f3e9651f472eb21d11594fba397c0 (diff) |
Fix symlink creation on windows
Diffstat (limited to 'tools/util.py')
-rw-r--r-- | tools/util.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/util.py b/tools/util.py index 8b8628aba..8a65f2ede 100644 --- a/tools/util.py +++ b/tools/util.py @@ -36,6 +36,10 @@ def symlink(target, name, target_is_dir=False): CreateSymbolicLinkW.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32) + # Replace forward slashes by backward slashes. + # Strangely it seems that this is only necessary for symlinks to files. + # Forward slashes don't cause any issues when the target is a directory. + target = target.replace("/", "\\") flags = 0x02 # SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE if (target_is_dir): flags |= 0x01 # SYMBOLIC_LINK_FLAG_DIRECTORY |