From 699d51189dd21dab229da82e6845618b4ab8c26c Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Thu, 4 Dec 2025 17:24:12 -0500 Subject: [PATCH] Fix ERRORLEVEL evaluation in all conditional checks Capture ERRORLEVEL values immediately after each command execution to prevent delayed expansion issues in nested conditionals. This fixes the "was unexpected at this time" error and ensures proper branch execution. --- scripts/build.bat | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/build.bat b/scripts/build.bat index 2af12da..a4fb697 100644 --- a/scripts/build.bat +++ b/scripts/build.bat @@ -25,7 +25,8 @@ REM Check for winget (required for auto-install) REM ---------------------------- set WINGET_AVAILABLE=0 where winget >nul 2>&1 -if %ERRORLEVEL% equ 0 ( +set WINGET_CHECK=!ERRORLEVEL! +if !WINGET_CHECK! equ 0 ( set WINGET_AVAILABLE=1 echo ✓ winget found (automatic installation available) ) else ( @@ -38,7 +39,8 @@ REM ---------------------------- REM Check for Git (recommended for development) REM ---------------------------- where git >nul 2>&1 -if %ERRORLEVEL% equ 0 ( +set GIT_CHECK=!ERRORLEVEL! +if !GIT_CHECK! equ 0 ( echo ✓ Git found git --version ) else ( @@ -74,7 +76,8 @@ REM ---------------------------- REM Check for GCC (required for CGO) REM ---------------------------- where gcc >nul 2>&1 -if %ERRORLEVEL% neq 0 ( +set GCC_CHECK=!ERRORLEVEL! +if !GCC_CHECK! neq 0 ( echo ⚠️ WARNING: GCC not found. CGO requires a C compiler. echo. echo VideoTools requires MinGW-w64 to build on Windows.