From bf3e86a5df2e48a4be3a3b568fcd983860de4845 Mon Sep 17 00:00:00 2001 From: Valerie Wolfe Date: Mon, 15 Jul 2024 10:26:31 -0400 Subject: [PATCH] scripts: 'pwsh' now uses a more reliable path and fallback --- scripts/pwsh.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/scripts/pwsh.sh b/scripts/pwsh.sh index a33d496..90c3bf8 100755 --- a/scripts/pwsh.sh +++ b/scripts/pwsh.sh @@ -3,19 +3,14 @@ env-share 2> /dev/null # try to use system-wide version first. -# this usually fails, but it's worth a shot. -if [[ -r '/mnt/c/Program Files/WindowsApps/' ]]; then - cd '/mnt/c/Program Files/WindowsApps/' - PWSH="`pwd`/`find Microsoft.PowerShell_* -name 'pwsh.exe'`" - cd - > /dev/null - if ! [ -x "$PWSH" ]; then - unset PWSH - fi +PWSH='/mnt/c/Program Files/PowerShell/7/pwsh.exe' +if [ -x "$PWSH" ]; then + unset PWSH fi -# fall back to user installation +# fall back to System32 if [ -z ${PWSH+x} ]; then - PWSH="`dos-var -p USERPROFILE`/AppData/Local/Microsoft/WindowsApps/pwsh.exe" + PWSH='/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe' fi # run target