From 13e0760e16576addab154616dc942dfdc5e848ef Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 8 Apr 2016 15:13:50 -0700 Subject: [PATCH] Fix build module for removal of Platform module --- PowerShellGitHubDev.psm1 | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index a5925a3e3..0f460a37c 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -1,7 +1,5 @@ # Use the .NET Core APIs to determine the current platform; if a runtime # exception is thrown, we are on FullCLR, not .NET Core. -# -# TODO: import Microsoft.PowerShell.Platform instead try { $Runtime = [System.Runtime.InteropServices.RuntimeInformation] $OSPlatform = [System.Runtime.InteropServices.OSPlatform] @@ -10,11 +8,15 @@ try { $IsLinux = $Runtime::IsOSPlatform($OSPlatform::Linux) $IsOSX = $Runtime::IsOSPlatform($OSPlatform::OSX) $IsWindows = $Runtime::IsOSPlatform($OSPlatform::Windows) -} catch [System.Management.Automation.RuntimeException] { - $IsCore = $false - $IsLinux = $false - $IsOSX = $false - $IsWindows = $true +} catch { + # If these are already set, then they're read-only and we're done + try { + $IsCore = $false + $IsLinux = $false + $IsOSX = $false + $IsWindows = $true + } + catch { } } @@ -122,9 +124,9 @@ function Start-PSBuild { # FullCLR only builds a library, so there is no runtime component if ($FullCLR) { - $script:Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $Executable) + $script:Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $Executable) } else { - $script:Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $Runtime, $Executable) + $script:Output = [IO.Path]::Combine($Top, "bin", $Configuration, $Framework, $Runtime, $Executable) } Write-Verbose "script:Output is $script:Output"