From 439ed829b516b78084ad21b548c8b2ee974d4569 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Fri, 31 May 2019 10:31:39 -0700 Subject: [PATCH] Fix redist Signed-off-by: dotnet-bot --- src/System.Private.CoreLib/shared/System/IO/PathInternal.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/System.Private.CoreLib/shared/System/IO/PathInternal.cs b/src/System.Private.CoreLib/shared/System/IO/PathInternal.cs index 3b864ac..12b97ec 100644 --- a/src/System.Private.CoreLib/shared/System/IO/PathInternal.cs +++ b/src/System.Private.CoreLib/shared/System/IO/PathInternal.cs @@ -15,8 +15,16 @@ namespace System.IO /// internal static bool StartsWithDirectorySeparator(ReadOnlySpan path) => path.Length > 0 && IsDirectorySeparator(path[0]); +#if MS_IO_REDIST internal static string EnsureTrailingSeparator(string path) - => Path.EndsInDirectorySeparator(path.AsSpan()) ? path : path + DirectorySeparatorCharAsString; + => EndsInDirectorySeparator(path) ? path : path + DirectorySeparatorCharAsString; + + internal static bool EndsInDirectorySeparator(string path) + => !string.IsNullOrEmpty(path) && IsDirectorySeparator(path[path.Length - 1]); +#else + internal static string EnsureTrailingSeparator(string path) + => Path.EndsInDirectorySeparator(path.AsSpan()) ? path : path + DirectorySeparatorCharAsString; +#endif internal static bool IsRoot(ReadOnlySpan path) => path.Length == GetRootLength(path); -- 2.7.4