I'm writing an custom ant task in java. I would like to get a list of all the files wit开发者_StackOverflow中文版hin a FileSet. What is the best way to do this?
Have a look at the example from Tutorial: Tasks using Properties, Filesets & Paths:
FileSet fs;
// ...
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] includedFiles = ds.getIncludedFiles();
for(int i=0; i<includedFiles.length; i++) {
String filename = includedFiles[i].replace('\\','/');
...
}
精彩评论