summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCharlie Barto <bartoc@umich.edu>2017-08-29 02:30:57 -0400
committerAndreas Rumpf <rumpf_a@web.de>2017-08-29 08:30:57 +0200
commit0d07117a65c001720d7b210b104abd427f2feaca (patch)
tree0955e49edac668fd6cdc92b11d6098d15fece484
parent920f4acadfabb7c426f272f8a57d08276eb1264e (diff)
downloadNim-0d07117a65c001720d7b210b104abd427f2feaca.tar.gz
allow non-admins to create symlinks on windows (#6287)
-rw-r--r--lib/pure/os.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index 2195f6327..bdf9813f9 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -1184,7 +1184,9 @@ proc createSymlink*(src, dest: string) =
   ## Some OS's (such as Microsoft Windows) restrict the creation
   ## of symlinks to root users (administrators).
   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:
       var wSrc = newWideCString(src)
       var wDst = newWideCString(dest)