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

platformutils: drop unnecessary netfx #ifdefs #1447

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
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
27 changes: 1 addition & 26 deletions src/shared/Core/PlatformUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static PlatformInformation GetPlatformInformation(ITrace2 trace2)
string osType = GetOSType();
string osVersion = GetOSVersion(trace2);
string cpuArch = GetCpuArchitecture();
string clrVersion = GetClrVersion();
string clrVersion = RuntimeInformation.FrameworkDescription;

return new PlatformInformation(osType, osVersion, cpuArch, clrVersion);
}
Expand Down Expand Up @@ -99,11 +99,7 @@ public static bool IsWindowsBrokerSupported()
/// <returns>True if running on macOS, false otherwise.</returns>
public static bool IsMacOS()
{
#if NETFRAMEWORK
return Environment.OSVersion.Platform == PlatformID.MacOSX;
#else
return RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
#endif
}

/// <summary>
Expand All @@ -112,11 +108,7 @@ public static bool IsMacOS()
/// <returns>True if running on Windows, false otherwise.</returns>
public static bool IsWindows()
{
#if NETFRAMEWORK
return Environment.OSVersion.Platform == PlatformID.Win32NT;
#else
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
#endif
}

/// <summary>
Expand All @@ -125,11 +117,7 @@ public static bool IsWindows()
/// <returns>True if running on a Linux distribution, false otherwise.</returns>
public static bool IsLinux()
{
#if NETFRAMEWORK
return Environment.OSVersion.Platform == PlatformID.Unix;
#else
return RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
#endif
}

/// <summary>
Expand Down Expand Up @@ -459,9 +447,6 @@ string GetLinuxDistroVersion()

private static string GetCpuArchitecture()
{
#if NETFRAMEWORK
return Environment.Is64BitOperatingSystem ? "x86-64" : "x86";
#else
switch (RuntimeInformation.OSArchitecture)
{
case Architecture.Arm:
Expand All @@ -475,16 +460,6 @@ private static string GetCpuArchitecture()
default:
return RuntimeInformation.OSArchitecture.ToString();
}
#endif
}

private static string GetClrVersion()
{
#if NETFRAMEWORK
return $".NET Framework {Environment.Version}";
#else
return RuntimeInformation.FrameworkDescription;
#endif
}

#endregion
Expand Down