Commit 0d68704a by Daniel Cohen Gindi Committed by Patrick Steinhardt

Support symlinks for directories in win32

(cherry picked from commit 37a7adb5)
parent 98c11905
...@@ -402,8 +402,12 @@ int p_symlink(const char *target, const char *path) ...@@ -402,8 +402,12 @@ int p_symlink(const char *target, const char *path)
git__utf8_to_16(target_w, MAX_PATH, target) < 0) git__utf8_to_16(target_w, MAX_PATH, target) < 0)
return -1; return -1;
if (!CreateSymbolicLinkW(path_w, target_w, DWORD dwFlags = SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;
SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE))
if (GetFileAttributesW(target_w) & FILE_ATTRIBUTE_DIRECTORY)
dwFlags |= SYMBOLIC_LINK_FLAG_DIRECTORY;
if (!CreateSymbolicLinkW(path_w, target_w, dwFlags))
return -1; return -1;
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment