MCPcopy Create free account
hub / github.com/egg82/fetcharr / delete

Method delete

Lib/src/main/java/me/egg82/arr/file/JSONFile.java:39–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37 }
38
39 public void delete() throws IOException {
40 File parent = file.getParentFile();
41 if (!parent.exists() || !parent.isDirectory()) {
42 return;
43 }
44
45 if (file.exists()) {
46 if (file.isDirectory()) {
47 try (Stream<Path> files = Files.walk(file.toPath())) {
48 files.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
49 }
50 } else {
51 Files.delete(file.toPath());
52 }
53 }
54 }
55
56 public boolean exists() {
57 return file.exists() && file.isFile();

Callers 3

initMethod · 0.45
downloadPluginsMethod · 0.45
writeMethod · 0.45

Calls 1

existsMethod · 0.80

Tested by

no test coverage detected