mirror of
https://github.com/denoland/deno.git
synced 2025-10-03 07:34:36 +00:00
Fix symlink creation on windows
This commit is contained in:
parent
5d1cb54261
commit
709b0cb90c
2 changed files with 8 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue