added one more method.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2002 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-01-31 14:14:27 +00:00
1 parent 783e9195cc
commit b2199a6f55
1 file changed
+25
+25
View File
@@ -412,6 +412,31 @@ public final class FilePath implements Serializable {
});
}
/**
* List up files in this directory that matches the given Ant-style filter.
*
* @param includes
* See {@link FileSet} for the syntax. String like "foo/*.zip".
*/
public FilePath[] list(final String includes) throws IOException, InterruptedException {
return act(new FileCallable<FilePath[]>() {
public FilePath[] invoke(File f, VirtualChannel channel) throws IOException {
FileSet fs = new FileSet();
fs.setDir(f);
fs.setIncludes(includes);
DirectoryScanner ds = fs.getDirectoryScanner(new org.apache.tools.ant.Project());
String[] files = ds.getIncludedFiles();
FilePath[] r = new FilePath[files.length];
for( int i=0; i<r.length; i++ )
r[i] = new FilePath(new File(f,files[i]));
return r;
}
});
}
/**
* Reads this file.
*/