ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: <classpath >as a source for <copy> ?
Date Tue, 05 Feb 2002 07:45:27 GMT
--- Bill Winspur <> wrote:
> Actually, having all the libs in one directory was my first workaround,

I meant, if all the files you need to copy come from subdirs relative to
one directory -- they didn't need to all be in the same directory, just
relative to one. 

> For now my technique of a limited number of library-location properites
> is working, but I may have time to make a version of Fileset that takes
> a files="path1,path2.." attribute,

You can already do that -- except the attribute is 'includes' -- but only
if the files listed are relative to the directory specified in the
<fileset>'s 'dir' attribute, not full paths. I'm not sure how you could
modify <fileset> to take a list of full-path filenames, or whether it'd
even be appropriate -- but you could probably modify <copy> to take a list
of files rather than either just a single file or a fileset.

In the meantime, as a workaround for if/when that modification gets done,
you could use the <script> task to take apart a comma-separated value of a
property and do the copies that way. Eg:
  <target name="copyfiles">
    <script language="javascript"> <![CDATA[
      todir = new File(projname.getProperty("copydir"));
      files = new StringTokenizer(projname.getProperty("files"), ",");
      while (files.hasMoreTokens()) {
        file = new File(files.nextToken());
        copyFile = projname.createTask("copy");
    ]]> </script>

(Where "copydir" is the property holding the value of the directory you're
copying to, and "files" is a property holding a comma-separated list of
relative or full-path filenames [assumes "files" lists at least two
filenames]. "projname" is the name specified in the 'name' attr of your
<project> tag).



Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message