Skip to content

Commit 54a857c

Browse files
authored
Merge pull request #414 from chrisbra/fix-rc-octal
appveyor.bat: avoid leading zero in PATCHLEVEL environment variable
2 parents 11e9f3d + 686575d commit 54a857c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

appveyor.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ for /F "delims=.-+ tokens=1-3" %%I in ("%VER_NUM%") do (
2727
set "PATCHLEVEL=%%K"
2828
)
2929

30+
:: PATCHLEVEL comes from tags like v9.2.0068.
31+
:: rc (and the C preprocessor) treat 0-prefixed numbers as octal, so 0068 breaks.
32+
:: Keep the original padded patchlevel, but normalize PATCHLEVEL to a plain decimal number.
33+
set "PATCHLEVEL_PADDED=%PATCHLEVEL%"
34+
for /F "tokens=* delims=0" %%P in ("%PATCHLEVEL_PADDED%") do set "PATCHLEVEL=%%P"
35+
if not defined PATCHLEVEL set "PATCHLEVEL=0"
36+
3037
if /I "%ARCH%"=="x64" (
3138
set "BIT=64"
3239
) else (

0 commit comments

Comments
 (0)