private static void deleteDirectoryImpl(Path path) throws IOException { requireNonNull(path, DIRECTORY_CAN_NOT_BE_NULL); File file = path.toFile(); if (!file.exists()) { return; } checkIO(!Files.isSymbolicLink(path), "Directory '%s' is a symbolic link", path); checkIO(!file.isFile(), "Directory '%s' is a file", path); Files.walkFileTree(path, DeleteRecursivelyFileVisitor.INSTANCE); checkIO(!file.exists(), "Unable to delete directory '%s'", path); }
private static void deleteDirectoryImpl(Path path) throws IOException { requireNonNull(path, DIRECTORY_CAN_NOT_BE_NULL); File file = path.toFile(); if (!file.exists()) { return; } checkIO(!Files.isSymbolicLink(path), "Directory '%s' is a symbolic link", path); checkIO(!file.isFile(), "Directory '%s' is a file", path); Files.walkFileTree(path, DeleteRecursivelyFileVisitor.INSTANCE); checkIO(!file.exists(), "Unable to delete directory '%s'", path); }