src/main/java/io/github/glytching/junit/extension/folder/TemporaryFolder.java
void destroy() throws IOException {
    if (rootFolder.exists()) {
      // walk the contents deleting each
      Files.walkFileTree(
          rootFolder.toPath(),
          new SimpleFileVisitor<Path>() {
            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attributes)
                throws IOException {
              return delete(file);
            }

            @Override
            public FileVisitResult postVisitDirectory(Path directory, IOException exception)
                throws IOException {
              return delete(directory);
            }

            @SuppressWarnings("SameReturnValue")
            private FileVisitResult delete(Path file) throws IOException {
              Files.delete(file);
              return CONTINUE;
            }
          });

      if (rootFolder.exists()) {
        // delete the parent, if it still exists
        Files.delete(rootFolder.toPath());
      }
    }
  }
void destroy() throws IOException {
    if (rootFolder.exists()) {
      // walk the contents deleting each
      Files.walkFileTree(
          rootFolder.toPath(),
          new SimpleFileVisitor<Path>() {
            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attributes)
                throws IOException {
              return delete(file);
            }

            @Override
            public FileVisitResult postVisitDirectory(Path directory, IOException exception)
                throws IOException {
              return delete(directory);
            }

            @SuppressWarnings("SameReturnValue")
            private FileVisitResult delete(Path file) throws IOException {
              Files.delete(file);
              return CONTINUE;
            }
          });

      if (rootFolder.exists()) {
        // delete the parent, if it still exists
        Files.delete(rootFolder.toPath());
      }
    }
  }
void destroy ( ) throws IOException { if ( rootFolder . exists ( ) ) { // walk the contents deleting each Files . walkFileTree ( rootFolder . toPath ( ) , new SimpleFileVisitor < Path > ( ) { @ Override public FileVisitResult visitFile ( Path file , BasicFileAttributes attributes ) throws IOException { return delete ( file ) ; } @ Override public FileVisitResult postVisitDirectory ( Path directory , IOException exception ) throws IOException { return delete ( directory ) ; } @ SuppressWarnings ( "SameReturnValue" ) private FileVisitResult delete ( Path file ) throws IOException { Files . delete ( file ) ; return CONTINUE ; } } ) ; if ( rootFolder . exists ( ) ) { // delete the parent, if it still exists Files . delete ( rootFolder . toPath ( ) ) ; } } }
Deletes the {@link #rootFolder} and all of its contents. This is package protected because a
{@link TemporaryFolder}'s lifecycle is expected to be controlled by its associated extension.

<p><b>Note</b>: any exception encountered during deletion will be swallowed.
Deletes the { @link #rootFolder } and all of its contents . This is package protected because a { @link TemporaryFolder } s lifecycle is expected to be controlled by its associated extension .