allow non-admins to create symlinks on windows (#6287)

This commit is contained in:
Charlie Barto 2017-08-29 02:30:57 -04:00 • committed by Andreas Rumpf
commit 0d07117a65

View file

@ -1184,7 +1184,9 @@ proc createSymlink*(src, dest: string) =
## Some OS's (such as Microsoft Windows) restrict the creation ## Some OS's (such as Microsoft Windows) restrict the creation
## of symlinks to root users (administrators). ## of symlinks to root users (administrators).
when defined(Windows): when defined(Windows):
let flag = dirExists(src).int32 # 2 is the SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE. This allows
# anyone with developer mode on to create a link
let flag = dirExists(src).int32 or 2
when useWinUnicode: when useWinUnicode:
var wSrc = newWideCString(src) var wSrc = newWideCString(src)
var wDst = newWideCString(dest) var wDst = newWideCString(dest)