allow non-admins to create symlinks on windows (#6287)
This commit is contained in:
parent
920f4acadf
commit
0d07117a65
1 changed files with 3 additions and 1 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue