Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
PathUtilities.cs
Go to the documentation of this file.
1using System.IO;
2
4
5internal static class PathUtilities
6{
8
10 {
11 get
12 {
14 {
16 }
18 }
19 }
20
21 internal static int IndexOfFileName(string path)
22 {
23 if (path == null)
24 {
25 return -1;
26 }
27 for (int num = path.Length - 1; num >= 0; num--)
28 {
29 char c = path[num];
30 if (c == '\\' || c == '/' || c == ':')
31 {
32 return num + 1;
33 }
34 }
35 return 0;
36 }
37
38 internal static string GetFileName(string path, bool includeExtension = true)
39 {
40 int num = IndexOfFileName(path);
41 if (num > 0)
42 {
43 return path.Substring(num);
44 }
45 return path;
46 }
47
48 internal static string CombinePathWithRelativePath(string root, string relativePath)
49 {
50 if (root.Length == 0)
51 {
52 return relativePath;
53 }
54 char c = root[root.Length - 1];
55 if (c == '\\' || c == '/' || c == ':')
56 {
57 return root + relativePath;
58 }
59 return root + PlatformSpecificDirectorySeparator + relativePath;
60 }
61}
int IList. IndexOf(object value)
Definition Array.cs:1228
static char[] GetInvalidFileNameChars()
Definition Path.cs:858
static string CombinePathWithRelativePath(string root, string relativePath)
static string GetFileName(string path, bool includeExtension=true)
static int IndexOfFileName(string path)