Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ public static partial class PlatformDetection
public static bool IsRedHatFamily7 => IsRedHatFamilyAndVersion(7);
public static bool IsNotFedoraOrRedHatFamily => !IsFedora && !IsRedHatFamily;
public static bool IsNotDebian10 => !IsDebian10;
public static bool IsNotApple =>
!RuntimeInformation.IsOSPlatform(OSPlatform.iOS) &&
!RuntimeInformation.IsOSPlatform(OSPlatform.OSX) &&
!RuntimeInformation.IsOSPlatform(OSPlatform.tvOS);

public static bool IsSuperUser => !IsWindows ?
libc.geteuid() == 0 :
throw new PlatformNotSupportedException();

public static Version OpenSslVersion => !IsOSX && !IsWindows ?
public static Version OpenSslVersion => IsNotApple && !IsWindows ?
GetOpenSslVersion() :
throw new PlatformNotSupportedException();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ public enum Architecture
private readonly int _dummyPrimitive;
public static System.Runtime.InteropServices.OSPlatform Browser { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform FreeBSD { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform iOS { get { throw null; } }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of adding this to the ref (which will be done in #36704 and needs API review), please instead use RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")) in the usages.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should a follow up after #36704 be to change them back to RuntimeInformation.IsOSPlatform(OSPlatform.iOS) and RuntimeInformation.IsOSPlatform(OSPlatform.tvOS)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally yes, but it's just a cosmetic cleanup

public static System.Runtime.InteropServices.OSPlatform Linux { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform OSX { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform tvOS { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform Windows { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform Create(string osPlatform) { throw null; }
public override bool Equals(object? obj) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ namespace System.Runtime.InteropServices

public static OSPlatform FreeBSD { get; } = new OSPlatform("FREEBSD");

public static OSPlatform iOS { get; } = new OSPlatform("IOS");

public static OSPlatform Linux { get; } = new OSPlatform("LINUX");

public static OSPlatform OSX { get; } = new OSPlatform("OSX");

public static OSPlatform tvOS { get; } = new OSPlatform("TVOS");

public static OSPlatform Windows { get; } = new OSPlatform("WINDOWS");

private OSPlatform(string osPlatform)
Expand Down