From dbe04da09326ecc88b441c57259a060a88c3e33d Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 4 Jul 2020 22:37:18 +0000 Subject: [PATCH] use PROCESSOR_ARCHITECTURE correctly --- _webi/webi.ps1 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/_webi/webi.ps1 b/_webi/webi.ps1 index b879673..0a1b89f 100644 --- a/_webi/webi.ps1 +++ b/_webi/webi.ps1 @@ -6,8 +6,14 @@ $ErrorActionPreference = 'Stop' # Ignore progress events from cmdlets so Invoke-WebRequest is not painfully slow $ProgressPreference = 'SilentlyContinue' -# TODO get arch -$Env:WEBI_UA = 'Windows/10 amd64' +# This is the canonical CPU arch when the process is emulated +$my_arch = "$Env:PROCESSOR_ARCHITEW6432" +IF ($my_arch -eq $null -or $my_arch -eq "") { + # This is the canonical CPU arch when the process is native + $my_arch = "$Env:PROCESSOR_ARCHITECTURE" +} +# TODO API should know to prefer x86 for windows when arm binary is not available +$Env:WEBI_UA = "Windows/10 $my_arch" $exename = $args[0] # Switch to userprofile @@ -48,9 +54,8 @@ if (!(Test-Path -Path .local\bin\pathman.exe)) } # Run pathman to set up the folder +# (using unix style path because... cmd vs powershell vs whatever) & "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/bin -#& "$Env:USERPROFILE\.local\bin\pathman.exe" add "$Env:USERPROFILE\.local\bin" -#& "$Env:USERPROFILE\.local\bin\pathman.exe" add %USERPROFILE%\.local\bin # {{ baseurl }} # {{ version }} -- 2.25.1