Good afternoon,
I'm working on windows. I'm trying to evaluate a fileset (ant speaking).
My code looks this way, today:
private String[] expandFileSet(AbstractBuild<?, ?> build, String pattern) {
List<String> fileNames = new ArrayList<String>();
try {
for (FilePath x: build.getWorkspace().list(pattern))
fileNames.add(x.getRemote());
} catch (IOException ioe) {}
catch (InterruptedException inte) {}
return fileNames.toArray(new String[fileNames.size()]);
}
where pattern looks like "**\*.Tests.dll"
My problem is that the list() method always returns an empty list.
Even with no parameter at all, list() returns an empty list. Even if the workspace contains a certain number of files or folders.
Previous I was using a function similar to
private String[] expandFileSet(AbstractBuild<?, ?> build, String pattern) {
String[] result = new String[]{pattern};
FileSet fileSet = new FileSet();
org.apache.tools.ant.Project project = new org.apache.tools.ant.Project();
fileSet.setProject(project);
try {
fileSet.setDir(new File(build.getWorkspace().toURI().getPath()));
fileSet.setIncludes(pattern);
} catch (IOException ioe) {
return result;
} catch (InterruptedException intE) {
return result;
}
return fileSet.getDirectoryScanner(project).getIncludedFiles();
}
(including an ant FileSet).
Well.. which is the best way to evaluate a fileset? Are there some considerations I should take into account on Windows?
Thanks in advance,
Ivo