Class FileUtil

java.lang.Object
wtf.ranked.hytale.server.runner.util.FileUtil

public final class FileUtil extends Object
Utility class for file and directory operations.

Provides helper methods for extracting archives and managing the cleanup of server files and directories.

  • Constructor Details

    • FileUtil

      public FileUtil()
  • Method Details

    • unpackZipFile

      public void unpackZipFile(@NonNull File zip, @NonNull File destinationPath)
      Extracts all contents of a ZIP archive to the specified destination and subsequently deletes the source archive file.
      Parameters:
      zip - the source ZIP archive file to extract
      destinationPath - the target directory where contents will be extracted
      Throws:
      RuntimeException - if an I/O error occurs during extraction or deletion
    • deleteFile

      public void deleteFile(@NonNull File file)
      Safely deletes a file or directory recursively.

      If the specified file or directory does not exist, no action is taken. Otherwise, it forces the deletion of the target and its contents.

      Parameters:
      file - the file or directory to delete