IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
PathExtensions.cs
Go to the documentation of this file.
1using System.IO;
2
4{
5
9 static class PathExtensions
10 {
11
12 public static readonly char[] DirectorySeparatorChars = new char[] { Path.DirectorySeparatorChar };
13
19 public static string TrimEndingDirectorySeparator(string path)
20 {
21#if NETFRAMEWORK
22 return path.TrimEnd(DirectorySeparatorChars);
23#else
24 return Path.TrimEndingDirectorySeparator(path);
25#endif
26 }
27
33 public static string EnsureEndingDirectorySeparator(string path)
34 {
35 return path[path.Length - 1] != Path.DirectorySeparatorChar ? path + Path.DirectorySeparatorChar : path;
36 }
37
38 }
39
40}
Various extension methods for working with paths.
static string EnsureEndingDirectorySeparator(string path)
Ensures the given path ends with a directory separator.
static readonly char[] DirectorySeparatorChars
static string TrimEndingDirectorySeparator(string path)
Trims any ending directory separator characters are removed from the path.