From 60e67651c32060ada2a2bfd0d52366cf91ef86cb Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 24 Feb 2017 14:30:56 -0800 Subject: Improve functions that detect ProgramFiles in powershell --- scripts/getProgramFiles32bit.ps1 | 12 +++++++++--- scripts/getProgramFilesPlatformBitness.ps1 | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/getProgramFiles32bit.ps1 b/scripts/getProgramFiles32bit.ps1 index fd7167191..6b71915b1 100644 --- a/scripts/getProgramFiles32bit.ps1 +++ b/scripts/getProgramFiles32bit.ps1 @@ -3,9 +3,15 @@ param( ) -if (Test-Path env:PROGRAMFILES`(X86`)) +$out = ${env:PROGRAMFILES(X86)} +if ($out -eq $null) { - return ${env:PROGRAMFILES(X86)} + $out = ${env:PROGRAMFILES} } -return ${env:PROGRAMFILES} \ No newline at end of file +if ($out -eq $null) +{ + throw "Could not find [Program Files 32-bit]" +} + +return $out \ No newline at end of file diff --git a/scripts/getProgramFilesPlatformBitness.ps1 b/scripts/getProgramFilesPlatformBitness.ps1 index 6d0a513ca..2be4c1137 100644 --- a/scripts/getProgramFilesPlatformBitness.ps1 +++ b/scripts/getProgramFilesPlatformBitness.ps1 @@ -3,9 +3,15 @@ param( ) -if (Test-Path env:ProgramW6432) +$out = ${env:ProgramW6432} +if ($out -eq $null) { - return ${env:ProgramW6432} + $out = ${env:PROGRAMFILES} } -return ${env:PROGRAMFILES} \ No newline at end of file +if ($out -eq $null) +{ + throw "Could not find [Program Files Platform Bitness]" +} + +return $out \ No newline at end of file -- cgit v1.2.3