code: private static String formatPathToDir(Path path) {
      return path.toString().endsWith(Path.SEPARATOR) ? path.toString() : path.toString() + Path.SEPARATOR;
    }
docs: Convert a {@link Path} to a {@link String} and make sure it is properly formatted to be recognized as a directory
  by {@link TarArchiveEntry}.