ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martin sweitzer <msewli...@gmail.com>
Subject Re: using fileset to only list the filenames and not the path+filename
Date Tue, 25 Oct 2005 09:07:36 GMT
That is what I have :-)

<apply dir="" executable="cmd.exe" output="aLog.log" append="true"
failonerror="true" force="true" relative="true" >

<arg line="/C ${commandLineParams.execName}" />

<targetfile/>
<arg line="args passed in"/>

<fileset dir="theDir">
<filename name="foo"/>
</fileset>

<flattenmapper/>


</apply>


I get:

myBat.bat FileName.extension <args passed in> <fullPath>\FileName.extension


On 10/25/05, Jan.Materne@rzf.fin-nrw.de <Jan.Materne@rzf.fin-nrw.de> wrote:
>
> Sorry, test code.
>
> <srcfile/> - is expanded to the file, <fileset> would give. With complete
> path.
> <targetfile/> - is the string after all <mapper>s are applied.
>
> So
> <apply ... relative="true">
> ...
> <targetfile/>
> <fileset .../>
> <flattenmapper/>
> </apply>
>
> should help.
>
>
> Jan
>
>
> >-----Urspr√ľngliche Nachricht-----
> >Von: martin sweitzer [mailto:msewlists@gmail.com]
> >Gesendet: Dienstag, 25. Oktober 2005 09:38
> >An: Ant Users List
> >Betreff: Re: using fileset to only list the filenames and not
> >the path+filename
> >
> >That almost works! :-)
> >
> >What happens is that I get the following:
> >
> >myBat.bat FileName.extension <args passed in>
> ><fullPath>\FileName.extension
> >
> >The <fullPath>\FileName.extension is tagged onto the end of
> >the parameters passed to the bat file. Is there any way to avoid this?
> >
> >Using ant 1.6.5
> >
> >
> >On 10/25/05, Jan.Materne@rzf.fin-nrw.de
> ><Jan.Materne@rzf.fin-nrw.de> wrote:
> >>
> >> First thought was simply adding a <flattenmapper/>, but <apply>
adds
> >> always the basedir. So you must also set the 'relative' to true.
> >>
> >>
> >> Jan
> >>
> >> ---
> >>
> >build.xml--8-<-------8-<-------8-<-------8-<-------8-<-------8-<------
> >> -8-<-------8-<----
> >> <project>
> >> <apply executable="cmd.exe" force="true" relative="true"> <arg
> >> line="/C myecho.bat"/> <srcfile/> <targetfile/> <fileset dir="."/>
> >>
> >> <flattenmapper/>
> >>
> >> </apply>
> >> </project>
> >> ---
> >>
> >myecho.bat--8-<-------8-<-------8-<-------8-<-------8-<-------8-<-----
> >> --8-<-------8-<----
> >> @echo off
> >> echo 1st param: %1
> >> echo 2nd param: %2
> >> echo .
> >>
> >>
> >---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
> >> ---8-<----
> >> Buildfile: build.xml
> >> [apply] 1st param: ant1\build.xml
> >> [apply] 2nd param: build.xml
> >> [apply] .
> >> [apply] 1st param: ant2\build.xml
> >> [apply] 2nd param: build.xml
> >> [apply] .
> >> [apply] 1st param: build.xml
> >> [apply] 2nd param: build.xml
> >> [apply] .
> >> [apply] 1st param: dir\ant3\build.xml
> >> [apply] 2nd param: build.xml
> >> [apply] .
> >> [apply] 1st param: dir\ant3\file.txt
> >> [apply] 2nd param: file.txt
> >> [apply] .
> >> [apply] 1st param: dir\ant4\build.xml
> >> [apply] 2nd param: build.xml
> >> [apply] .
> >> [apply] 1st param: files.zip
> >> [apply] 2nd param: files.zip
> >> [apply] .
> >> [apply] 1st param: myecho.bat
> >> [apply] 2nd param: myecho.bat
> >> [apply] .
> >>
> >>
> >---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
> >> ---8-<----
> >>
> >>
> >>
> >>
> >>
> >> >-----Urspr√ľngliche Nachricht-----
> >> >Von: martin sweitzer [mailto:msewlists@gmail.com]
> >> >Gesendet: Dienstag, 25. Oktober 2005 04:20
> >> >An: user@ant.apache.org
> >> >Betreff: using fileset to only list the filenames and not the
> >> >path+filename
> >> >
> >> >How does one utilize fileset to only list the filenames and not the
> >> >path+filename?
> >> >
> >> >example:
> >> >
> >> ><apply dir="aDir" executable="anExe" output="aLog" append="true"
> >> >failonerror="true" >
> >> >
> >> ><fileset dir="baz">
> >> ><filename name="**/*.foo"/>
> >> ></fileset>
> >> >
> >> ><srcfile/>
> >> >
> >> ><arg value="a bunch of params"/>
> >> >
> >> ></apply>
> >> >
> >> >
> >> >That will result in the something like the following:
> >> >
> >> >anExe d:/foo/bar/baz/file0 "a bunch of params"
> >> >anExe d:/foo/bar/baz/file1 "a bunch of params"
> >> >anExe d:/foo/bar/baz/file2 "a bunch of params"
> >> >anExe d:/foo/bar/baz/file3 "a bunch of params"
> >> >anExe d:/foo/bar/baz/file4 "a bunch of params"
> >> >
> >> >
> >> >The output desired would be:
> >> >
> >> >anExe file0 a bunch of params
> >> >anExe file1 a bunch of params
> >> >anExe file2 a bunch of params
> >> >anExe file3 a bunch of params
> >> >anExe file4 a bunch of params
> >> >
> >> >
> >> >So:
> >> >
> >> >0) how to get rid of the full path
> >> >1) how to get rid of the " " around the arg values
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For
> >additional
> >> commands, e-mail: user-help@ant.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message