// Perform absolute path pattern search
// The root to start search from
Path root = PathMatchers.getSearchRoot(pattern);
// The matcher for file hits
PathMatcher matcher = PathMatchers.getMatcher(pattern);
if (FS.isValidDirectory(root))
{
PathFinder finder = new PathFinder();
finder.setIncludeDirsInResults(true);
finder.setFileMatcher(matcher);
finder.setBase(root);
Files.walkFileTree(root,SEARCH_VISIT_OPTIONS,MAX_SEARCH_DEPTH,finder);
hits.addAll(finder.getHits());
}
}
else
{
// Perform relative path pattern search
Path relativePath = PathMatchers.getSearchRoot(pattern);
PathMatcher matcher = PathMatchers.getMatcher(pattern);
PathFinder finder = new PathFinder();
finder.setIncludeDirsInResults(true);
finder.setFileMatcher(matcher);
// walk config sources backwards ...