From 709b0cb90cec938cbfd3d49ed1c35fa949bda36a Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Sat, 21 Jul 2018 03:52:00 +0200 Subject: Fix symlink creation on windows --- tools/util.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/util.py') 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 -- cgit v1.2.3