ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan \"Rambius\" Ivanov" <rambiusparkisan...@yahoo.com>
Subject RE: Create a file that contains files in directory
Date Thu, 20 Apr 2006 01:10:34 GMT
Hello,

--- "Guttula, Mohan" <MGuttula@tiaa-cref.org> wrote:

> The issue was with relative path in the base
> directory. i.e., 
> <property name="master_base" value="release"/>
> 
> Issue is resolved by using IVAN suggestion which is
> as follows:
> -----
> <property name="master_base" location="release"/>
> -----

Defining location of files and dirs with location
attribute comes vary handy when one deals with
mappers. This attribute allows you to cite the files
with their relative (to ${basedir}) names and yet Ant
deals works with their absolute paths taking care of
slashes and backslashes.

> 
> Ivan - do you know if I can append "@" to the
> beginning of each line in
> the target directory. i.e., 
> **** Target file (master.sql) *****
> @temp/temp.tab
> @temp1/temp1.ind
> @temp2/temp2.trg
> @temp3/temp3.seq
> @temp4/temp4.ind
> @temp5/temp5.trg
> ******************

I believe you can do it:
    <pathconvert property="all.files"
pathsep="${line.separator}"
        refid="all.files.fs">
        <globmapper
from="${basedir}${file.separator}*" to="@*"/>
    </pathconvert>

> I also want to know if we can use some Ant task to
> rearrange line the
> target file (or should I write my custom ANT task).
> For example in the
> following way
> ******** Final "master.sql"*****
> @temp/temp.tab
> @temp1/temp1.ind
> @temp4/temp4.ind
> @temp2/temp2.trg
> @temp5/temp5.trg
> @temp3/temp3.seq
> ********
> 
> In the above file, I have to rearrange lines based
> on the extension.

In the examples above, we use <fileset>s which
collects the files in a random way, which is not
controlled by Ant, but by the underlying OS. If you
deal only with not so many different extensions you
can define <fileset>s for each of them and repeat
pathconvert + mapper trick for each <fileset> (and
that sounds like a  <macrodef>)

Regards
Ivan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message