From 1318c0f59407a0034d8ac7e1f8910f676e705824 Mon Sep 17 00:00:00 2001 From: Michael Hsu Date: Mon, 11 Nov 2019 10:59:06 +0800 Subject: [PATCH] Add special handling for -XX, -XX:+ and -XX:0 --- src/universal/bin/sbt.bat | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/universal/bin/sbt.bat b/src/universal/bin/sbt.bat index 46fceb0a6..417b79ad3 100755 --- a/src/universal/bin/sbt.bat +++ b/src/universal/bin/sbt.bat @@ -428,8 +428,8 @@ if "%g:~0,2%" == "-D" ( ) ) -if "%g:~0,3%" == "-XX" ( - rem special handling for -D since '=' gets parsed away +if not "%g:~0,5%" == "-XX:+" if not "%g:~0,5%" == "-XX:-" if "%g:~0,3%" == "-XX" ( + rem special handling for -XX since '=' gets parsed away for /F "tokens=1 delims==" %%a in ("%g%") do ( rem make sure it doesn't have the '=' already if "%g%" == "%%a" ( @@ -614,21 +614,25 @@ set "p=%0" if "%p:~0,2%" == "-D" ( rem special handling for -D since '=' gets parsed away - echo "%p%" | find "=" > nul - if ERRORLEVEL 1 if not "%~1" == "" ( - echo %0=%1 - shift - goto echolist + for /F "tokens=1 delims==" %%a in ("%p%") do ( + rem make sure it doesn't have the '=' already + if "%p%" == "%%a" if not "%~1" == "" ( + echo %0=%1 + shift + goto echolist + ) ) ) -if "%p:~0,3%" == "-XX" ( - rem special handling for -D since '=' gets parsed away - echo "%p%" | find "=" > nul - if ERRORLEVEL 1 if not "%~1" == "" ( - echo %0=%1 - shift - goto echolist +if not "%p:~0,5%" == "-XX:+" if not "%p:~0,5%" == "-XX:-" if "%p:~0,3%" == "-XX" ( + rem special handling for -XX since '=' gets parsed away + for /F "tokens=1 delims==" %%a in ("%p%") do ( + rem make sure it doesn't have the '=' already + if "%p%" == "%%a" if not "%~1" == "" ( + echo %0=%1 + shift + goto echolist + ) ) )