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). ConfigurationHandler remains the facade through which consumers access these checks.

    • Constructor Detail

      • ModpackZipInspector

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

      • getZipCheck

         final Regex getZipCheck()

        Matches a ZIP entry that is a bare top-level directory — how a modpack export's nesting is detected.

        The single source of truth: ConfigurationHandler.zipCheck reads this rather than holding its own copy, so the published constant and the pattern inspection uses cannot drift apart.

      • 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.

        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.

        destination — The destination to where the ZIP-archive was about to be extracted to.

      • getFilesInModpackZip

         final List<String> getFilesInModpackZip(File zipFile)

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

        zipFile — The ZIP-archive to get the list of files from.