ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Winspur" <bwins...@wynnon.com>
Subject Re: <classpath >as a source for <copy> ?
Date Tue, 05 Feb 2002 16:50:25 GMT
Thanks Diane, neat idea. I had not thought of the script tag, Bill.
----- Original Message -----
From: "Diane Holt" <holtdl@yahoo.com>
To: "Ant Users List" <ant-user@jakarta.apache.org>
Sent: Tuesday, February 05, 2002 12:45 AM
Subject: Re: <classpath >as a source for <copy> ?


> --- Bill Winspur <bwinspur@wynnon.com> 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
>
> =====
> (holtdl@yahoo.com)
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
>


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


Mime
View raw message