diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-24 14:30:56 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-24 14:30:56 -0800 |
| commit | 60e67651c32060ada2a2bfd0d52366cf91ef86cb (patch) | |
| tree | 9951e7934d27fccd882d2e683d14578661afd9b3 | |
| parent | e4ff363f5c4732235c288496e1c6798968a158ce (diff) | |
| download | vcpkg-60e67651c32060ada2a2bfd0d52366cf91ef86cb.tar.gz vcpkg-60e67651c32060ada2a2bfd0d52366cf91ef86cb.zip | |
Improve functions that detect ProgramFiles in powershell
| -rw-r--r-- | scripts/getProgramFiles32bit.ps1 | 12 | ||||
| -rw-r--r-- | scripts/getProgramFilesPlatformBitness.ps1 | 12 |
2 files changed, 18 insertions, 6 deletions
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 |
