Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use IsOSPlatform instead of checking for /proc #101547

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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