Browse Source

Allow ant to handle parameters with spaces under Win systems

I added a few other things to Bill's patch, such as setlocal and
endlocal calls.

Submitted by:	Bill Burton [billb@progress.com]


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268527 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 24 years ago
parent
commit
8911539f3b
1 changed files with 19 additions and 8 deletions
  1. +19
    -8
      src/script/ant.bat

+ 19
- 8
src/script/ant.bat View File

@@ -2,7 +2,9 @@


if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat" if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"


if not "%OS%"=="Windows_NT" goto start
if not "%OS%"=="Windows_NT" goto win9xStart
:winNTStart
@setlocal


rem %~dp0 is name of current script under NT rem %~dp0 is name of current script under NT
set DEFAULT_ANT_HOME=%~dp0 set DEFAULT_ANT_HOME=%~dp0
@@ -10,25 +12,28 @@ set DEFAULT_ANT_HOME=%~dp0
rem : operator works similar to make : operator rem : operator works similar to make : operator
set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME:\bin\=% set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME:\bin\=%


if "%ANT_HOME%"=="" set ANT_HOME=%DEFAULT_ANT_HOME%
if %ANT_HOME%a==a set ANT_HOME=%DEFAULT_ANT_HOME%
set DEFAULT_ANT_HOME= set DEFAULT_ANT_HOME=


:start
rem On NT/2K grab all arguments at once
set ANT_CMD_LINE_ARGS=%*
goto doneStart


:win9xStart
rem Slurp the command line arguments. This loop allows for an unlimited number of rem Slurp the command line arguments. This loop allows for an unlimited number of
rem agruments (up to the command line limit, anyway). rem agruments (up to the command line limit, anyway).


set ANT_CMD_LINE_ARGS= set ANT_CMD_LINE_ARGS=


:setupArgs :setupArgs
if "%1"=="" goto doneArgs
if %1a==a goto doneStart
set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1 set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
shift shift
goto setupArgs goto setupArgs


:doneArgs
rem The doneArgs label is here just to provide a place for the argument list loop
rem to break out to.
:doneStart
rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.


rem find ANT_HOME rem find ANT_HOME
if not "%ANT_HOME%"=="" goto checkJava if not "%ANT_HOME%"=="" goto checkJava
@@ -80,7 +85,13 @@ goto end
%_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" -Djikes.class.path=%JIKESPATH% %ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS% %_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" -Djikes.class.path=%JIKESPATH% %ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%


:end :end
if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"
set LOCALCLASSPATH= set LOCALCLASSPATH=
set ANT_CMD_LINE_ARGS= set ANT_CMD_LINE_ARGS=


if not "%OS%"=="Windows_NT" goto mainEnd
:winNTend
@endlocal

:mainEnd
if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"


Loading…
Cancel
Save