code: public static Path expandIfZip(Path filePath) throws IOException {
          if (!isZipFile(filePath)) {
              return filePath;
          }
  
          FileTime pluginZipDate = Files.getLastModifiedTime(filePath);
          String fileName = filePath.getFileName().toString();
          Path pluginDirectory = filePath.resolveSibling(fileName.substring(0, fileName.lastIndexOf(".")));
  
          if (!Files.exists(pluginDirectory) || pluginZipDate.compareTo(Files.getLastModifiedTime(pluginDirectory)) > 0) {
              // do not overwrite an old version, remove it
              if (Files.exists(pluginDirectory)) {
                  FileUtils.delete(pluginDirectory);
              }
  
              // create root for plugin
              Files.createDirectories(pluginDirectory);
  
              // expand '.zip' file
              Unzip unzip = new Unzip();
              unzip.setSource(filePath.toFile());
              unzip.setDestination(pluginDirectory.toFile());
              unzip.extract();
              log.info("Expanded plugin zip '{}' in '{}'", filePath.getFileName(), pluginDirectory.getFileName());
          }
  
          return pluginDirectory;
      }
docs: Unzip a zip file in a directory that has the same name as the zip file.
  For example if the zip file is {@code my-plugin.zip} then the resulted directory
  is {@code my-plugin}.
  
  @param filePath the file to evaluate
  @return Path of unzipped folder or original path if this was not a zip file
  @throws IOException on error