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

◆ GetCleanPath()

static string Microsoft.Xna.Framework.TitleContainer.GetCleanPath ( string path)
inlinestaticpackage

Definition at line 52 of file TitleContainer.cs.

53 {
54 path = path.Replace('/', '\\');
55 path = path.Replace("\\.\\", "\\");
56 while (path.StartsWith(".\\"))
57 {
58 path = path.Substring(".\\".Length);
59 }
60 while (path.EndsWith("\\."))
61 {
62 path = ((path.Length <= "\\.".Length) ? "\\" : path.Substring(0, path.Length - "\\.".Length));
63 }
64 int num;
65 for (num = 1; num < path.Length; num = CollapseParentDirectory(ref path, num, "\\..\\".Length))
66 {
67 num = path.IndexOf("\\..\\", num);
68 if (num < 0)
69 {
70 break;
71 }
72 }
73 if (path.EndsWith("\\.."))
74 {
75 num = path.Length - "\\..".Length;
76 if (num > 0)
77 {
78 CollapseParentDirectory(ref path, num, "\\..".Length);
79 }
80 }
81 if (path == ".")
82 {
83 path = string.Empty;
84 }
85 return path;
86 }
static int CollapseParentDirectory(ref string path, int position, int removeLength)

References Microsoft.Xna.Framework.TitleContainer.CollapseParentDirectory().

Referenced by Microsoft.Xna.Framework.TitleContainer.IsPathAbsolute(), and Microsoft.Xna.Framework.TitleContainer.OpenStream().