ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "North Alex" <>
Subject RE: [A solution] Inserting text at start of file
Date Wed, 02 Apr 2003 10:02:14 GMT

>From: Stefan Bodewig [] 

>> I have come up with a complicated-well-over-the-top way of copying 
>> files and using the concat task.
>Why copy?

Because I have an existing file.

This is what I came up with:

    <!-- pre-pend text to a file -->
    <!-- prerequisites:, -->
    <target name="">
        <dirname property="prepend.dir" file="${}"/>
        <copy file="${}"
        <concat destfile="${}"
        <concat destfile="${}" append="true">
            <fileset file="${prepend.dir}/temp.txt"/>
            <fileset dir="${prepend.dir}" includes="temp.txt"/>

This solution is simpler than the one I had before and is usable from
all of our projects now (as it is in a common script).  It still seems
incredibly painful for something that should maybe be part of the concat
task or maybe even a sister task.

Thanks Jan, Peter, and Stefan very much for your input! :)

<= Alex =>

View raw message