mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add PowerShell variables corresponding to platform
This deprecates the Microsoft.PowerShell.Platform module and ensure that IsLinux/OSX/Windows/Core variables are defined all throughout PowerShell.
This commit is contained in:
@@ -5101,6 +5101,32 @@ end
|
||||
RemotingErrorIdStrings.PSSessionAppName,
|
||||
ScopedItemOptions.None),
|
||||
// End: Variables which control remoting behavior
|
||||
|
||||
#region Platform
|
||||
new SessionStateVariableEntry(
|
||||
SpecialVariables.IsLinux,
|
||||
Platform.IsLinux,
|
||||
String.Empty,
|
||||
ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
|
||||
new SessionStateVariableEntry(
|
||||
SpecialVariables.IsOSX,
|
||||
Platform.IsOSX,
|
||||
String.Empty,
|
||||
ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
|
||||
new SessionStateVariableEntry(
|
||||
SpecialVariables.IsWindows,
|
||||
Platform.IsWindows,
|
||||
String.Empty,
|
||||
ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
|
||||
new SessionStateVariableEntry(
|
||||
SpecialVariables.IsCore,
|
||||
Platform.IsCore,
|
||||
String.Empty,
|
||||
ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
|
||||
#endregion
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -156,6 +156,20 @@ namespace System.Management.Automation
|
||||
internal const string PSModuleAutoLoading = "PSModuleAutoLoadingPreference";
|
||||
internal static VariablePath PSModuleAutoLoadingPreferenceVarPath = new VariablePath("global:" + PSModuleAutoLoading);
|
||||
|
||||
#region Platform Variables
|
||||
internal const string IsLinux = "IsLinux";
|
||||
internal static VariablePath IsLinuxPath = new VariablePath("IsLinux");
|
||||
|
||||
internal const string IsOSX = "IsOSX";
|
||||
internal static VariablePath IsOSXPath = new VariablePath("IsOSX");
|
||||
|
||||
internal const string IsWindows = "IsWindows";
|
||||
internal static VariablePath IsWindowsPath = new VariablePath("IsWindows");
|
||||
|
||||
internal const string IsCore = "IsCore";
|
||||
internal static VariablePath IsCorePath = new VariablePath("IsCore");
|
||||
|
||||
#endregion
|
||||
#region Preference Variables
|
||||
|
||||
internal const string DebugPreference = "DebugPreference";
|
||||
|
||||
Reference in New Issue
Block a user