Skip to content

Commit

Permalink
Fix symlink creation on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus authored and ry committed Jul 21, 2018
1 parent 5d1cb54 commit 709b0cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/build_third_party.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
run(["gclient", "sync", "--reset", "--shallow", "--no-history", "--nohooks"],
envs={'GCLIENT_FILE': root_path + "/gclient_config.py"})
# TODO(ry) Is it possible to remove these symlinks?
remove_and_symlink("v8/third_party/googletest", "googletest")
remove_and_symlink("v8/third_party/jinja2", "jinja2")
remove_and_symlink("v8/third_party/llvm-build", "llvm-build")
remove_and_symlink("v8/third_party/markupsafe", "markupsafe")
remove_and_symlink("v8/third_party/googletest", "googletest", True)
remove_and_symlink("v8/third_party/jinja2", "jinja2", True)
remove_and_symlink("v8/third_party/llvm-build", "llvm-build", True)
remove_and_symlink("v8/third_party/markupsafe", "markupsafe", True)

# To update the deno_third_party git repo after running this, try the following:
# cd third_party
Expand Down
4 changes: 4 additions & 0 deletions tools/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 709b0cb

Please sign in to comment.