Skip to content

Commit

Permalink
Add quotes around the VCPKG_ROOT and Z_POWERSHELL_EXE variable path a…
Browse files Browse the repository at this point in the history
…ssignments. (#1354)

Without adding quotes around the set variable path assignments, paths that contain a close parenthesis character `)` would cause the command/batch file to exit prematurely and vs batch call chains (e.g., vcvarsall.bat) to fail.
  • Loading branch information
jcbrill authored Feb 27, 2024
1 parent bf4f159 commit 8e0de0c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vcpkg-init/vcpkg-init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,22 @@ IF EXIST $null DEL $null
:: Figure out where VCPKG_ROOT is
IF EXIST "%~dp0.vcpkg-root" (
SET VCPKG_ROOT=%~dp0
SET "VCPKG_ROOT=%~dp0"
)
IF "%VCPKG_ROOT:~-1%"=="\" (
SET VCPKG_ROOT=%VCPKG_ROOT:~0,-1%
SET "VCPKG_ROOT=%VCPKG_ROOT:~0,-1%"
)
IF "%VCPKG_ROOT%"=="" (
SET VCPKG_ROOT=%USERPROFILE%\.vcpkg
SET "VCPKG_ROOT=%USERPROFILE%\.vcpkg"
)
:: Call powershell which may or may not invoke bootstrap if there's a version mismatch
SET Z_POWERSHELL_EXE=
FOR %%i IN (pwsh.exe powershell.exe) DO (
IF EXIST "%%~$PATH:i" (
SET Z_POWERSHELL_EXE=%%~$PATH:i
SET "Z_POWERSHELL_EXE=%%~$PATH:i"
GOTO :gotpwsh
)
)
Expand Down

0 comments on commit 8e0de0c

Please sign in to comment.