summaryrefslogtreecommitdiff
path: root/src/mscorlib/shared/System/IO/PathInternal.Unix.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/shared/System/IO/PathInternal.Unix.cs')
-rw-r--r--src/mscorlib/shared/System/IO/PathInternal.Unix.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mscorlib/shared/System/IO/PathInternal.Unix.cs b/src/mscorlib/shared/System/IO/PathInternal.Unix.cs
index 08dc1d0251..ac9c4e77cd 100644
--- a/src/mscorlib/shared/System/IO/PathInternal.Unix.cs
+++ b/src/mscorlib/shared/System/IO/PathInternal.Unix.cs
@@ -100,5 +100,10 @@ namespace System.IO
// As long as the path is rooted in Unix it doesn't use the current directory and therefore is fully qualified.
return !Path.IsPathRooted(path);
}
+
+ internal static string TrimEndingDirectorySeparator(string path) =>
+ path.Length > 1 && IsDirectorySeparator(path[path.Length - 1]) ? // exclude root "/"
+ path.Substring(0, path.Length - 1) :
+ path;
}
}