public static List<File> listFilesRecursively(File baseDir) throws IOException {
    if (!baseDir.exists()) return emptyList();

    List<File> result = new ArrayList<>();
    doListFilesRecursively(baseDir, result);
    return result;
  }
Returns the text read from the given stream as a String.
Closes the given stream upon return.
spock-core/src/main/java/org/spockframework/util/IoUtil.java