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

◆ GetVolumeName()

static ReadOnlySpan< char > System.IO.Path.GetVolumeName ( ReadOnlySpan< char > path)
inlinestaticpackage

Definition at line 1036 of file Path.cs.

1037 {
1038 ReadOnlySpan<char> pathRoot = GetPathRoot(path);
1039 if (pathRoot.Length == 0)
1040 {
1041 return pathRoot;
1042 }
1043 int num = GetUncRootLength(path);
1044 if (num == -1)
1045 {
1046 num = (PathInternal.IsDevice(path) ? 4 : 0);
1047 }
1048 ReadOnlySpan<char> readOnlySpan = pathRoot.Slice(num);
1049 if (!EndsInDirectorySeparator(readOnlySpan))
1050 {
1051 return readOnlySpan;
1052 }
1053 return readOnlySpan.Slice(0, readOnlySpan.Length - 1);
1054 }
static ? string GetPathRoot(string? path)
Definition Path.cs:1008
static int GetUncRootLength(ReadOnlySpan< char > path)
Definition Path.cs:1056
static bool EndsInDirectorySeparator(ReadOnlySpan< char > path)
Definition Path.cs:848

References System.IO.Path.EndsInDirectorySeparator(), System.IO.Path.GetPathRoot(), System.IO.Path.GetUncRootLength(), System.IO.PathInternal.IsDevice(), System.ReadOnlySpan< T >.Length, and System.ReadOnlySpan< T >.Slice().

Referenced by System.IO.Path.GetFullPath().