Thanks Diane, neat idea. I had not thought of the script tag, Bill.
----- Original Message -----
From: "Diane Holt" <[EMAIL PROTECTED]>
To: "Ant Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, February 05, 2002 12:45 AM
Subject: Re: <classpath >as a source for <copy> ?


> --- Bill Winspur <[EMAIL PROTECTED]> 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[
>       importClass(java.io.File);
>       importClass(java.util.StringTokenizer);
>       todir = new File(projname.getProperty("copydir"));
>       files = new StringTokenizer(projname.getProperty("files"), ",");
>       while (files.hasMoreTokens()) {
>         file = new File(files.nextToken());
>         copyFile = projname.createTask("copy");
>         copyFile.setFile(file);
>         copyFile.setTodir(todir);
>         copyFile.setFlatten(true);
>         copyFile.execute();
>       }
>     ]]> </script>
>   </target>
>
> (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).
>
> Diane
>
> =====
> ([EMAIL PROTECTED])
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to