mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-09-04 23:27:21 +00:00
Added FolderChildrenTests and FolderTests
* implemented some testcases * fixed some issues
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package org.cryptomator.filesystem;
|
||||
|
||||
public class Deleter {
|
||||
|
||||
/**
|
||||
* Deletes all and only the content of a given {@link Folder} but <b>not</b> the folder itself.
|
||||
*/
|
||||
public static void deleteContent(Folder folder) {
|
||||
if (folder.exists()) {
|
||||
folder.folders().forEach(Folder::delete);
|
||||
folder.files().forEach(File::delete);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -75,4 +75,10 @@ public interface File extends Node, Comparable<File> {
|
||||
Mover.move(this, destination);
|
||||
}
|
||||
|
||||
default void delete() {
|
||||
try (WritableFile writableFile = openWritable()) {
|
||||
writableFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public interface Folder extends Node {
|
||||
* @return the created {@code Stream}
|
||||
* @throws UncheckedIOException
|
||||
* if an {@link IOException} occurs while initializing the
|
||||
* stream
|
||||
* stream or the {@code Folder} does not exist
|
||||
*/
|
||||
Stream<? extends Node> children() throws UncheckedIOException;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user