Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ GetDirectoryNameOffset()

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

Definition at line 149 of file Path.cs.

150 {
151 int rootLength = PathInternal.GetRootLength(path);
152 int num = path.Length;
153 if (num <= rootLength)
154 {
155 return -1;
156 }
157 while (num > rootLength && !PathInternal.IsDirectorySeparator(path[--num]))
158 {
159 }
160 while (num > rootLength && PathInternal.IsDirectorySeparator(path[num - 1]))
161 {
162 num--;
163 }
164 return num;
165 }

References System.IO.PathInternal.GetRootLength(), System.IO.PathInternal.IsDirectorySeparator(), and System.ReadOnlySpan< T >.Length.

Referenced by System.IO.Path.GetDirectoryName(), and System.IO.Path.GetDirectoryName().