Merge pull request #793 from Cyberboss/FuckWindowsSymlinks [TGSDeploy]

Fuck windows symlinks. Version 4.0.1.2
This commit is contained in:
Jordan Brown
2018-10-21 01:39:19 -04:00
committed by GitHub
5 changed files with 13 additions and 14 deletions
@@ -4,7 +4,7 @@
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<DebugType>Full</DebugType>
<Version>4.0.1.1</Version>
<Version>4.0.1.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
@@ -7,5 +7,5 @@ using System.Runtime.InteropServices;
[assembly: Guid("29927416-3b78-49a7-a560-5ccaa638b6b4")]
[assembly: InternalsVisibleTo("Tgstation.Server.Host.Service.Tests")]
[assembly: AssemblyVersion("4.0.1.1")]
[assembly: AssemblyFileVersion("4.0.1.1")]
[assembly: AssemblyVersion("4.0.1.2")]
[assembly: AssemblyFileVersion("4.0.1.2")]
@@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<DebugType>Full</DebugType>
<AddSyntheticProjectReferencesForSolutionDependencies>false</AddSyntheticProjectReferencesForSolutionDependencies>
<Version>4.0.1.1</Version>
<Version>4.0.1.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
@@ -22,19 +22,18 @@ namespace Tgstation.Server.Host.IO
//check if its not a file
var flags = File.Exists(targetPath) ? NativeMethods.CreateSymbolicLinkFlags.None : NativeMethods.CreateSymbolicLinkFlags.Directory;
flags |= NativeMethods.CreateSymbolicLinkFlags.AllowUnprivilegedCreate;
//no don't fucking use this
//sure it works in SOME cases
//i.e. win10 1803+ and IN DEVELOPER MODE
//other times it throws ERROR_INVALID_PARAMETER
//but the fucking worst is there is some configuration of windows that accept the argument and allow the function to succeed
//BUT IT DOESN'T CREATE THE FUCKING LINK
//I AM NOT DEBUGGING THAT SHIT AGAIN AHHH
//flags |= NativeMethods.CreateSymbolicLinkFlags.AllowUnprivilegedCreate;
cancellationToken.ThrowIfCancellationRequested();
if (!NativeMethods.CreateSymbolicLink(linkPath, targetPath, flags))
{
if (Win32Exception.GetLastWin32Error() == Win32Error.ERROR_INVALID_PARAMETER) //SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE isn't supported
{
flags &= ~NativeMethods.CreateSymbolicLinkFlags.AllowUnprivilegedCreate;
if (NativeMethods.CreateSymbolicLink(linkPath, targetPath, flags))
return;
}
throw new Win32Exception();
}
}, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current);
}
}
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<DebugType>Full</DebugType>
<Version>4.0.1.1</Version>
<Version>4.0.1.2</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">