diff --git a/Windows/git-version-gen.cmd b/Windows/git-version-gen.cmd index cd8e494953..a203a52976 100644 --- a/Windows/git-version-gen.cmd +++ b/Windows/git-version-gen.cmd @@ -16,23 +16,22 @@ rem // If not, see http://www.gnu.org/licenses/ rem // Official git repository and contact information can be found at rem // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -setlocal +setlocal ENABLEDELAYEDEXPANSION set GIT_VERSION_FILE=%~p0..\git-version.cpp if "%GIT%" == "" ( - set GIT=git + set GIT="git" ) -"%GIT%" describe > NUL 2> NUL +%GIT% describe > NUL 2> NUL if errorlevel 1 ( echo Git not on path, trying default Msysgit paths - set GIT=C:\Program Files ^(x86^)\Git\bin\git.exe - "%GIT%" describe > NUL 2> NUL + set GIT="%ProgramFiles(x86)%\Git\bin\git.exe" + !GIT! describe > NUL 2> NUL if errorlevel 1 ( - set GIT=C:\Program Files\Git\bin\git.exe + set GIT="%ProgramFiles%\Git\bin\git.exe" ) ) -goto done if exist "%GIT_VERSION_FILE%" ( rem // Skip updating the file if PPSSPP_GIT_VERSION_NO_UPDATE is 1. @@ -42,7 +41,7 @@ if exist "%GIT_VERSION_FILE%" ( ) ) -"%GIT%" describe --always > NUL 2> NUL +%GIT% describe --always > NUL 2> NUL if errorlevel 1 ( echo Unable to update git-version.cpp, git not found. @@ -52,7 +51,7 @@ if errorlevel 1 ( goto done ) -for /F %%I IN ('"%GIT%" describe --always') do set GIT_VERSION=%%I +for /F %%I IN ('%GIT% describe --always') do set GIT_VERSION=%%I rem // Don't modify the file if it already has the current version. if exist "%GIT_VERSION_FILE%" (