Return-Path: Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 75030 invoked from network); 17 Jan 2001 00:04:10 -0000 Received: from pscgate.progress.com (192.77.186.1) by h31.sny.collab.net with SMTP; 17 Jan 2001 00:04:10 -0000 Received: from elvirus.progress.com (elvirus [192.77.186.100]) by pscgate.progress.com (8.10.2/8.10.2/PSC-4.01) with ESMTP id f0H04Gi06337 for ; Tue, 16 Jan 2001 19:04:16 -0500 (EST) Received: from progress.COM (localhost [127.0.0.1]) by elvirus.progress.com (8.10.2/8.10.2/PSC-4.01) with ESMTP id f0H06FS24712 for ; Tue, 16 Jan 2001 19:06:15 -0500 (EST) Received: from naserv.bedford.progress.com (naserv [172.16.5.174]) by progress.COM (8.7.2/PSC-1.0) with ESMTP id TAA19959 for ; Tue, 16 Jan 2001 19:04:15 -0500 (EST) Received: from progress.com ([172.16.107.175]) by naserv.bedford.progress.com (Netscape Messaging Server 4.15) with ESMTP id G7A5J300.M94 for ; Tue, 16 Jan 2001 19:04:15 -0500 Message-ID: <3A64E17E.CCE17484@progress.com> Date: Tue, 16 Jan 2001 19:04:14 -0500 From: "Bill Burton" Organization: Progress Software Corporation X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en-US,ja MIME-Version: 1.0 To: ant-user@jakarta.apache.org Subject: Re: Passing in -D argument with space (Problem Solved + Patch!) References: <3A63CB0E.E3EEE4CC@sendmail.com> <000f01c07f92$c5267ac0$0100280a@nshome> <3A648287.97051D50@sendmail.com> <3A64A37C.3F0D0E94@sendmail.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N 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" > > > To: "Ant User" > > > 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