From 3365aeaf5553ee371d3fdd3ae6c560c8b1f40552 Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Thu, 25 Apr 2024 16:48:56 +0300 Subject: [PATCH] Use IsOSPlatform instead of checking for /proc --- .../test/Mono.Linker.Tests/Extensions/NiceIO.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/tools/illink/test/Mono.Linker.Tests/Extensions/NiceIO.cs b/src/tools/illink/test/Mono.Linker.Tests/Extensions/NiceIO.cs index 6969069dc904..21871a9770f6 100644 --- a/src/tools/illink/test/Mono.Linker.Tests/Extensions/NiceIO.cs +++ b/src/tools/illink/test/Mono.Linker.Tests/Extensions/NiceIO.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // The MIT License(MIT) @@ -31,13 +31,15 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Text; namespace Mono.Linker.Tests.Extensions { public class NPath : IEquatable, IComparable { - private static readonly StringComparison PathStringComparison = IsLinux () ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; + private static readonly StringComparison PathStringComparison = RuntimeInformation.IsOSPlatform (OSPlatform.Windows) ? + StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; private readonly string[] _elements; private readonly bool _isRelative; @@ -804,11 +806,6 @@ static bool AlwaysTrue (NPath p) { return true; } - - private static bool IsLinux () - { - return Directory.Exists ("/proc"); - } } public static class Extensions