MCPcopy Create free account
hub / github.com/diffplug/goomph / list

Method list

src/main/java/com/diffplug/gradle/FileMisc.java:76–91  ·  view source on GitHub ↗

Lists the children of the given file in a safe way (File#listFiles() can return null).

(File d)

Source from the content-addressed store, hash-verified

74 ///////////////////////////////////////////////////////////////////
75 /** Lists the children of the given file in a safe way ({@link File#listFiles()} can return null). */
76 public static List<File> list(File d) {
77 return retry(d, dir -> {
78 File[] children = dir.listFiles();
79 if (children == null) {
80 if (dir.isFile()) {
81 throw new IllegalArgumentException("Can't list " + dir + " because it is a file, not a directory.");
82 } else if (!dir.exists()) {
83 throw new IllegalArgumentException("Can't list " + dir + " because it does not exist.");
84 } else {
85 throw new IllegalArgumentException("Can't list " + dir + ", not sure why.");
86 }
87 } else {
88 return Arrays.asList(children);
89 }
90 });
91 }
92
93 /** Calls {@link File#mkdirs()} and throws an exception if it fails. */
94 public static void mkdirs(File d) {

Callers 15

assertFolderContentsMethod · 0.95
testCaseMethod · 0.95
mainMethod · 0.95
testMethod · 0.95
cleanDirMethod · 0.95
flattenMethod · 0.95
PluginCatalogMethod · 0.95
WorkspaceRegistryMethod · 0.95
workspaceExistsMethod · 0.95
EquinoxLauncherMethod · 0.95

Calls 1

retryMethod · 0.95

Tested by 4

assertFolderContentsMethod · 0.76
testCaseMethod · 0.76
mainMethod · 0.76
testMethod · 0.76