Skip to content
Open
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
56 changes: 56 additions & 0 deletions src/System.Management.Automation/CoreCLR/CorePsPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,28 @@ namespace System.Management.Automation
/// </summary>
public static partial class Platform
{
/// <summary>
/// True if the current platform is Android.
/// </summary>
public static bool IsAndroid
{
get
{
return OperatingSystem.IsAndroid();
}
}

/// <summary>
/// True if the current platform is Browser.
/// </summary>
public static bool IsBrowser
{
get
{
return OperatingSystem.IsBrowser();
}
}

/// <summary>
/// True if the current platform is Linux.
/// </summary>
Expand All @@ -37,6 +59,17 @@ public static bool IsMacOS
}
}

/// <summary>
/// True if the current platform is Wasi.
/// </summary>
public static bool IsWasi
{
get
{
return OperatingSystem.IsWasi();
}
}

/// <summary>
/// True if the current platform is Windows.
/// </summary>
Expand All @@ -59,6 +92,17 @@ public static bool IsCoreCLR
}
}

/// <summary>
/// True if PowerShell was built targeting MonoRuntime .
/// </summary>
public static bool IsMonoRuntime
{
get
{
return Type.GetType("Mono.RuntimeStructs") != null;
}
}

/// <summary>
/// True if the underlying system is NanoServer.
/// </summary>
Expand Down Expand Up @@ -146,6 +190,18 @@ public static bool IsWindowsDesktop
}
}

/// <summary>
/// True if the underlying system is SingleFile Bundle.
/// </summary>
public static bool IsSingleFile
{
get
{
// if SMA assembly location is null, PowerShell is published as a single file bundle
return string.IsNullOrEmpty(typeof(PSObject).Assembly.Location);
}
}

/// <summary>
/// Gets a value indicating whether the underlying system supports single-threaded apartment.
/// </summary>
Expand Down