Fix unprivileged file symlink creation

This commit is contained in:
Cyberboss
2018-10-02 11:37:24 -04:00
parent bd56de8ad2
commit 2bc0eaee7b
@@ -21,7 +21,7 @@ namespace Tgstation.Server.Host.IO
throw new ArgumentNullException(nameof(linkPath));
//check if its not a file
var flags = File.Exists(targetPath) ? 0 : 3; //SYMBOLIC_LINK_FLAG_DIRECTORY | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE on win10 1607+ developer mode
var flags = File.Exists(targetPath) ? 2 : 3; //SYMBOLIC_LINK_FLAG_DIRECTORY and SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE on win10 1607+ developer mode
cancellationToken.ThrowIfCancellationRequested();
if (!NativeMethods.CreateSymbolicLink(linkPath, targetPath, flags))