// else, might be a link which points to nothing, or has been removed while we're visiting, or ...
throw new GradleException(String.format("Could not list contents of '%s'.", file));
}
for (File child : children) {
if (stopFlag.get()) { break; }
if (step.matches(child.getName())) {
relativePath.addLast(child.getName());
doVisitDirOrFile(visitor, child, relativePath, segmentIndex + 1, stopFlag);
relativePath.removeLast();
}
}