Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateSymbolicLink()

static void Interop.Kernel32.CreateSymbolicLink ( string symlinkFileName,
string targetFileName,
bool isDirectory )
inlinestaticpackage

Definition at line 777 of file Interop.cs.

778 {
779 string path = symlinkFileName;
780 symlinkFileName = PathInternal.EnsureExtendedPrefixIfNeeded(symlinkFileName);
781 targetFileName = PathInternal.EnsureExtendedPrefixIfNeeded(targetFileName);
782 int num = 0;
783 bool flag = (Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build >= 14972) || Environment.OSVersion.Version.Major >= 11;
784 if (flag)
785 {
786 num = 2;
787 }
788 if (isDirectory)
789 {
790 num |= 1;
791 }
792 if (!CreateSymbolicLinkPrivate(symlinkFileName, targetFileName, num))
793 {
795 }
796 int lastWin32Error;
797 if (!flag && (lastWin32Error = Marshal.GetLastWin32Error()) != 0)
798 {
799 throw Win32Marshal.GetExceptionForWin32Error(lastWin32Error, path);
800 }
801 }
static bool CreateSymbolicLinkPrivate(string lpSymlinkFileName, string lpTargetFileName, int dwFlags)
static OperatingSystem OSVersion
static string EnsureExtendedPrefixIfNeeded(string path)
static Exception GetExceptionForLastWin32Error(string path="")
static Exception GetExceptionForWin32Error(int errorCode, string path="")

References Interop.Kernel32.CreateSymbolicLinkPrivate(), System.IO.PathInternal.EnsureExtendedPrefixIfNeeded(), System.IO.Win32Marshal.GetExceptionForLastWin32Error(), System.IO.Win32Marshal.GetExceptionForWin32Error(), System.Runtime.InteropServices.Marshal.GetLastWin32Error(), and System.Environment.OSVersion.

Referenced by System.IO.FileSystem.CreateSymbolicLink().