Fix -D with quotes

Fixe https://github.com/sbt/sbt/issues/5192
This commit is contained in:
Eugene Yokota 2019-10-16 10:48:11 -04:00
parent 546a8b8949
commit 71a216c037
1 changed files with 18 additions and 12 deletions

View File

@ -381,17 +381,22 @@ if /I "%~0" == "new" (
) )
if /I "%g:~0,2%" == "-D" ( if /I "%g:~0,2%" == "-D" (
rem special handling for -D since '=' gets parsed away rem special handling for -D since '=' gets parsed away
if x%g:^==% == x%g% ( echo "%g%" | find "=" > null
if not "%~1" == "" ( if ERRORLEVEL 1 (
set SBT_ARGS=!SBT_ARGS! %0=%1 if not "%~1" == "" (
shift set SBT_ARGS=!SBT_ARGS! %0=%1
goto args_loop shift
) else ( goto args_loop
echo %g is missing a value ) else (
goto error echo %g% is missing a value
) goto error
) )
) else (
set SBT_ARGS=!SBT_ARGS! %~0
echo found !SBT_ARGS!
goto args_loop
)
) )
rem the %0 (instead of %~0) preserves original argument quoting rem the %0 (instead of %~0) preserves original argument quoting
@ -550,7 +555,8 @@ rem special handling for -D since '=' gets parsed away
if /I "%p:~0,2%" == "-D" ( if /I "%p:~0,2%" == "-D" (
rem if "-Dscala.ext.dirs" (replace all = with nothing) == "-Dscala.ext.dirs" rem if "-Dscala.ext.dirs" (replace all = with nothing) == "-Dscala.ext.dirs"
rem (e.g. verify it doesn't have the = already) rem (e.g. verify it doesn't have the = already)
if x%p:^==% == x%p% if not "%~1" == "" (
if "x%p:^==%" == "x%p%" if not "%~1" == "" (
echo %0=%1 echo %0=%1
shift shift
goto echolist goto echolist