diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/FilePathComparison.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/FilePathComparison.cs new file mode 100644 index 0000000000..057f71cb86 --- /dev/null +++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/FilePathComparison.cs @@ -0,0 +1,30 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.CodeAnalysis.Razor +{ + internal static class FilePathComparison + { + private static StringComparison? _instance; + + public static StringComparison Instance + { + get + { + if (_instance == null && RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + _instance = StringComparison.Ordinal; + } + else if (_instance == null) + { + _instance = StringComparison.OrdinalIgnoreCase; + } + + return _instance.Value; + } + } + } +}