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

◆ GetFullPath() [2/2]

static string System.IO.Path.GetFullPath ( string path,
string basePath )
inlinestatic

Definition at line 898 of file Path.cs.

899 {
900 if (path == null)
901 {
902 throw new ArgumentNullException("path");
903 }
904 if (basePath == null)
905 {
906 throw new ArgumentNullException("basePath");
907 }
908 if (!IsPathFullyQualified(basePath))
909 {
910 throw new ArgumentException(SR.Arg_BasePathNotFullyQualified, "basePath");
911 }
912 if (basePath.Contains('\0') || path.Contains('\0'))
913 {
914 throw new ArgumentException(SR.Argument_InvalidPathChars);
915 }
916 if (IsPathFullyQualified(path))
917 {
918 return GetFullPathInternal(path);
919 }
920 if (PathInternal.IsEffectivelyEmpty(path.AsSpan()))
921 {
922 return basePath;
923 }
924 int length = path.Length;
925 string text = ((length >= 1 && PathInternal.IsDirectorySeparator(path[0])) ? Join(GetPathRoot(basePath.AsSpan()), path.AsSpan(1)) : ((length < 2 || !PathInternal.IsValidDriveChar(path[0]) || path[1] != ':') ? JoinInternal(basePath.AsSpan(), path.AsSpan()) : ((!GetVolumeName(path.AsSpan()).EqualsOrdinal(GetVolumeName(basePath.AsSpan()))) ? ((!PathInternal.IsDevice(basePath.AsSpan())) ? path.Insert(2, "\\") : ((length == 2) ? JoinInternal(basePath.AsSpan(0, 4), path.AsSpan(), "\\".AsSpan()) : JoinInternal(basePath.AsSpan(0, 4), path.AsSpan(0, 2), "\\".AsSpan(), path.AsSpan(2)))) : Join(basePath.AsSpan(), path.AsSpan(2)))));
926 if (!PathInternal.IsDevice(text.AsSpan()))
927 {
929 }
930 return PathInternal.RemoveRelativeSegments(text, PathInternal.GetRootLength(text.AsSpan()));
931 }
static string Join(ReadOnlySpan< char > path1, ReadOnlySpan< char > path2)
Definition Path.cs:387
static ? string GetPathRoot(string? path)
Definition Path.cs:1008
static bool IsPathFullyQualified(string path)
Definition Path.cs:264
static string GetFullPathInternal(string path)
Definition Path.cs:933
static ReadOnlySpan< char > GetVolumeName(ReadOnlySpan< char > path)
Definition Path.cs:1036
static string JoinInternal(ReadOnlySpan< char > first, ReadOnlySpan< char > second)
Definition Path.cs:641

References System.SR.Arg_BasePathNotFullyQualified, System.SR.Argument_InvalidPathChars, System.IO.Path.GetFullPathInternal(), System.IO.Path.GetPathRoot(), System.IO.PathInternal.GetRootLength(), System.IO.Path.GetVolumeName(), System.IO.PathInternal.IsDevice(), System.IO.PathInternal.IsDirectorySeparator(), System.IO.PathInternal.IsEffectivelyEmpty(), System.IO.Path.IsPathFullyQualified(), System.IO.PathInternal.IsValidDriveChar(), System.IO.Path.Join(), System.IO.Path.JoinInternal(), System.length, System.IO.PathInternal.RemoveRelativeSegments(), and System.text.