ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <bi...@progress.com>
Subject Re: Passing in -D argument with space (Problem Solved + Patch!)
Date Wed, 17 Jan 2001 00:04:14 GMT
Hello,

The %* expansion does NOT work in Windows 9x, nor does the fancy stuff you
can do in a for loop, i.e. assigning the output of the cd command to a
variable.  So that patch should not be applied.

I've started to look at this and should be able to submit a patch later
today or tomorrow that will fix the problem on NT/2K and may also provide
at least a partial fix for Windows 9x.

-Bill Burton

William Lee wrote:
> 
> It's somewhat weird to reply to my own post.  I've figured that the
> problem is in ant.bat.  The part where it tries to "slurp" the arguments
> doesn't work with spaces.  I actually don't know why the code is there
> since I used the %* (which means %1 - %9) to pass the argument to java
> and it seems to work all right.  (Is it because the number of arguments
> can be more than 9??)  Anyway, here is the patch for ant.bat that I used
> to get this working:
> 
> (Note that I've only tested it out using Windows NT 4 SP 6a, somebody
> should try this under Win 2K and 98)
> 
> 17a18,29
> > rem Slurp the command line arguments.  This loop allows for an unlimited number
of
> > rem agruments (up to the command line limit, anyway).
> >
> > set ANT_CMD_LINE_ARGS=
> >
> > :setupArgs
> > if "%1"=="" goto doneArgs
> > set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
> > shift
> > goto setupArgs
> >
> > :doneArgs
> 64c76
> < %_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%"
> %ANT_OPTS% org.apache.tools.ant.Main %*
> ---
> > %_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" %ANT_OPTS% org.apache.tools.ant.Main
%ANT_CMD_LINE_ARGS%
> 68c80
> < %JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%"
> -Djikes.class.path=%JIKESPATH% %ANT_OPTS% org.apache.tools.ant.Main %*
> ---
> > %JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" -Djikes.class.path=%JIKESPATH%
%ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
> 72a85
> > set ANT_CMD_LINE_ARGS=
> 
> Can the Ant team take a look at the patch?
> 
> Will
> 
> William Lee wrote:
> >
> > Doing ant "-DPROP=dir with space" would yield the same error... BTW, if
> > anyone knows how to get the short name (with the ~) for the current
> > directory and can assign it to a variable I'd be grateful.  It's
> > somewhat unrelated to ant, but it's nice to have this working with ant
> > script so we can all pass in path name as argument.  The dir /x would
> > list the name fine but here is what I'm doing:
> >
> > for /F "eol=; delims=," %%f in ('cd') do (
> >         set TARGET_DIR=%%f
> > )
> >
> > ant -DTARGET_DIR=%TARGET_DIR%
> >
> > etc...
> >
> > 'cd' would yield the full path name.  What I did here is to assign the
> > current directory to the TARGET_DIR variable and pass it to the ant
> > script.  This works perfectly fine if the directory doesn't have space
> > in it.  Does anyone know how I can convert the long name to short name?
> >
> > Will
> >
> > Nico Seessle wrote:
> > >
> > > ----- Original Message -----
> > > From: "William Lee" <wlee@sendmail.com>
> > > To: "Ant User" <ant-user@jakarta.apache.org>
> > > Sent: Tuesday, January 16, 2001 5:16 AM
> > > Subject: Passing in -D argument with space to the ant.bat script
> > >
> > > > The "ant.bat" script that comes with Ant 1.2 doesn't seem to support -D
> > > > options with space in it.  For example, I can do:
> > > >
> > > > c:\> ant -DPROP="dir with space"
> > > >
> > > > I'll get:
> > > >
> > > > with was unexpected at this time.
> > > >
> > > Can you try out
> > >
> > > c:\> ant "-DPROP=dir with space"?
> > >
> > > Looks funny, but may work better...
> > >
> > > Nico

Mime
View raw message