diff --git a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs index f6accdcf54..26847b6170 100644 --- a/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs +++ b/src/System.Management.Automation/CoreCLR/CorePsPlatform.cs @@ -68,16 +68,16 @@ namespace System.Management.Automation } } - // true if cross-platform (always for this project) - internal static bool IsX() + public static const bool IsCore { -#if CORECLR - // CoreCLR version is cross-platform - return true; -#else - // FullCLR is not cross-platform - return false; -#endif + get + { + #if CORECLR + return true; + #else + return false; + #endif + } } // format files @@ -115,7 +115,7 @@ namespace System.Management.Automation internal static bool UsesCodeSignedAssemblies() { - return !Platform.IsX(); + return !Platform.IsCore; } // This is mainly with respect to the auto-mounting of diff --git a/src/System.Management.Automation/commands/utility/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs b/src/System.Management.Automation/commands/utility/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs index f374345224..1127b1e1dc 100644 --- a/src/System.Management.Automation/commands/utility/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs +++ b/src/System.Management.Automation/commands/utility/FormatAndOutput/common/DisplayDatabase/typeDataXmlLoader.cs @@ -1810,7 +1810,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format // optional pre-load and binding verification // Porting Note: DLL.resources are not currently available on Linux - if (!Platform.IsX() && this.VerifyStringResources) + if (!Platform.IsCore && this.VerifyStringResources) { DisplayResourceManagerCache.LoadingResult result; DisplayResourceManagerCache.AssemblyBindingStatus bindingStatus; diff --git a/src/System.Management.Automation/engine/CommandDiscovery.cs b/src/System.Management.Automation/engine/CommandDiscovery.cs index 2d57504b8b..2d0e2e917e 100644 --- a/src/System.Management.Automation/engine/CommandDiscovery.cs +++ b/src/System.Management.Automation/engine/CommandDiscovery.cs @@ -1323,7 +1323,7 @@ namespace System.Management.Automation // Close the progress pane that may have popped up from analyzing UNC paths. // Porting note: we don't like this message - if (!Platform.IsX() && context.CurrentCommandProcessor != null) + if (!Platform.IsCore && context.CurrentCommandProcessor != null) { ProgressRecord analysisProgress = new ProgressRecord(0, Modules.ScriptAnalysisPreparing, " "); analysisProgress.RecordType = ProgressRecordType.Completed; diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index e4bc81a630..e1d807dcaf 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -5648,7 +5648,7 @@ if($paths) { // Porting note: the snapins still require 'ProcessorArchitecture=MSIL' in // the strong name, which is not in the strong name of assemblies created // by dotnet-cli - if (!Platform.IsX() && + if (!Platform.IsCore && !string.Equals(assemblyName.FullName, psSnapInInfo.AssemblyName, StringComparison.OrdinalIgnoreCase)) { string message = StringUtil.Format(ConsoleInfoErrorStrings.PSSnapInAssemblyNameMismatch, psSnapInInfo.AbsoluteModulePath, psSnapInInfo.AssemblyName); diff --git a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs index 3243b074d4..6fe29f7e8f 100644 --- a/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs +++ b/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs @@ -763,7 +763,7 @@ namespace System.Management.Automation // Porting note: Open PowerShell has a Modules folder in the the application base path which contains the built-in modules // It must be in the front of the path no matter what. - if (Platform.IsX()) + if (Platform.IsCore) { currentProcessModulePath = AddToPath(currentProcessModulePath, GetSystemwideModulePath(), 0); } diff --git a/src/System.Management.Automation/engine/SecurityManagerBase.cs b/src/System.Management.Automation/engine/SecurityManagerBase.cs index 8d89b859bc..a9120d27d2 100644 --- a/src/System.Management.Automation/engine/SecurityManagerBase.cs +++ b/src/System.Management.Automation/engine/SecurityManagerBase.cs @@ -90,7 +90,7 @@ namespace System.Management.Automation // TODO:PSL this is a workaround since the exception below // hides the internal issue of what's going on in terms of // execution policy. - if (Platform.IsX()) + if (Platform.IsCore) { return; } diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index 1c9edc414a..2c960f93ec 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -240,7 +240,7 @@ namespace System.Management.Automation /// internal static string GetApplicationBase(string shellId) { - if (!Platform.IsX()) + if (!Platform.IsCore) { // try to get the path from the registry first string result = GetApplicationBaseFromRegistry(shellId); @@ -305,7 +305,7 @@ namespace System.Management.Automation // And built-in modules string progFileDir; - if (Platform.IsX()) + if (Platform.IsCore) { progFileDir = Path.Combine(appBase, "Modules"); } diff --git a/src/System.Management.Automation/security/SecuritySupport.cs b/src/System.Management.Automation/security/SecuritySupport.cs index 1a6b0ff4fb..755b1df4cb 100644 --- a/src/System.Management.Automation/security/SecuritySupport.cs +++ b/src/System.Management.Automation/security/SecuritySupport.cs @@ -433,7 +433,7 @@ namespace System.Management.Automation // There is no signature support on non-Windows platforms (yet), when // execution reaches here, we are sure the file is under product folder - if (Platform.IsX()) + if (Platform.IsCore) { return true; }