Class ModpackZipInspector

  • All Implemented Interfaces:

    
    public final class ModpackZipInspector
    
                        

    Inspector for modpack ZIP-archives: lists their contents and checks their validity as modpacks (full-pack layout with mods- and config-directories in the archive-root). Extracted from ConfigurationHandler (refactor Phase 1c); ConfigurationHandler remains the facade through which consumers access these checks.

    • Constructor Detail

      • ModpackZipInspector

        ModpackZipInspector(Function1<File, ZipFile> openZip)
    • Method Detail

      • checkZipArchive

         final ConfigCheck checkZipArchive(String pathToZip, ConfigCheck configCheck)

        Check a given ZIP-archives contents. If the ZIP-archive only contains one directory, or if it contains neither the mods nor the config directories, consider it invalid.

        Parameters:
        pathToZip - Path to the ZIP-file to check.
      • unzipDestination

         final String unzipDestination(String destination)

        Update the destination to which the ZIP-archive will the extracted to, based on whether a directory of the same name already exists.

        Parameters:
        destination - The destination to where the ZIP-archive was about to be extracted to.
        Returns:

        The destination where the ZIP-archive will be extracted to.

      • getDirectoriesInModpackZipBaseDirectory

         final List<String> getDirectoriesInModpackZipBaseDirectory(File zipFile)

        Acquire a list of directories in the base-directory of a ZIP-file.

        Parameters:
        zipFile - The ZIP-archive to get the list of files from.
        Returns:

        All directories in the base-directory of the ZIP-file.

      • getAllFilesAndDirectoriesInModpackZip

         final List<String> getAllFilesAndDirectoriesInModpackZip(File zipFile)

        Acquire a list of all files and directories in a ZIP-file.

        Parameters:
        zipFile - The ZIP-archive to get the list of files from.
        Returns:

        All files and directories in the ZIP-file.

      • getDirectoriesInModpackZip

         final List<String> getDirectoriesInModpackZip(File zipFile)

        Acquire a list of all directories in a ZIP-file. The resulting list excludes files.

        Parameters:
        zipFile - The ZIP-archive to get the list of files from.
        Returns:

        All directories in the ZIP-file.

      • getFilesInModpackZip

         final List<String> getFilesInModpackZip(File zipFile)

        Acquire a list of all files in a ZIP-file. The resulting list excludes directories.

        Parameters:
        zipFile - The ZIP-archive to get the list of files from.
        Returns:

        All files in the ZIP-file.