Skip to content

Commit

Permalink
Use IsOSPlatform instead of checking for /proc (#101547)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
  • Loading branch information
am11 and jkotas committed Jun 4, 2024
1 parent 9d02188 commit 7803a96
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/tools/illink/test/Mono.Linker.Tests/Extensions/NiceIO.cs
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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<NPath>, 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;
Expand Down Expand Up @@ -804,11 +806,6 @@ static bool AlwaysTrue (NPath p)
{
return true;
}

private static bool IsLinux ()
{
return Directory.Exists ("/proc");
}
}

public static class Extensions
Expand Down

0 comments on commit 7803a96

Please sign in to comment.