Thanks for the suggestions. They all sounded painful or involved more dependencies :(
For the moment I've gone with a glorious hack: 1) Use the Xalan redirect extension to output the cgi. I'm already using this extension so am not worried about new dependencies. 2) Use the Ant replace tag to remove the <?xml...> and newlines from the top of the created file. Ugly I know :) Hen On Mon, 14 Feb 2005 09:20:31 +0100, Stefan Bodewig <[EMAIL PROTECTED]> wrote: > On Sun, 13 Feb 2005, Henri Yandell <[EMAIL PROTECTED]> wrote: > > > To do this copying, I basically want to do the equivalent of: > > > > ------- > > For each downloads_*.html file > > copy downloads.cgi downloads_*.cgi > > -------- > > > > Any idea how I do that in Ant? > > The first answer which many people in Ant land won't like is, use > AntContrib's[1] <for> or <foreach> task. > > > Mappers seem like they'd want to be copying the html file to the cgi > > file; ie) wildcard in to and from. > > You can do better than that. > > The first thing you want is having copy to copy to multiple target > files, to do this you need Ant 1.6 and set the enablemultipolemappings > attribute to true. > > To create the mappings, the best solution is writing a custom mapper, > this sounds more difficult than it actually is, in particular if you > are willing to use Ant 1.6.2 where you can simply <typedef> a new > mapper. > > The basic idea is that you write a class that implements > FileNameMapper, has a dir attribute (read a public setDir(File) > method), completely ignores the from and to attributes and scans the > given directory for downlod_*.html files on the first invocation of > mapFileName. mapFileName then returns null for any argument that's > not download.cgi and an array consisting of all download_*.cgi files > you need for download.cgi. > > Let me know if you want to go that route and my description turns out > to be too sketchy. > > Cheers > > Stefan > > Footnotes: > [1] http://ant-contrib.sf.net/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
