ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Assinging file sets to a property
Date Thu, 19 Apr 2001 06:02:45 GMT
Son of Mojo JoJo <neologic@jabberwock.wonderland.com> wrote:

> does anyone know a way to get a COMMA sepearted list of files from a
> fileset?

This is currently not possible without writing a task of your own that
does so - either in Java or as a <script>, here's an untested Java
snippet that does what you want

FileSet fs = (FileSet) (new Reference("myref")).getReferencedObject(project);
DirectoryScanner ds = fs.getDirectoryScanner(project);
StringBuffer sb = new StringBuffer();
String[] files = ds.getIncludedFiles();
for (int i = 0; i < files.length;i++) {
    if (i > 0) {
        sb.append(",");
    }
    sb.append(files[i]);
}
project.setProperty("my-comma-sep-list", sb.toString());

Stefan

Mime
View raw message