From bfd7bfd739968af5b7bad17134783deedd424f1f Mon Sep 17 00:00:00 2001 From: Chocohead Date: Tue, 17 Mar 2020 23:28:47 +0000 Subject: Add support for reading/writing zipped mappings (#199) * Add support to read/write Enigma mappings from ZIP Takes any path which points to a ZIP as wanting to be read/written as a ZIP Paths from an existing ZIP file system will be correctly handled as directories * Fix deleting a path needing to be from the default file system * Allow calling MapSpecializedMethodsCommand directly * Fix indentation * Missing static--- src/main/java/cuchaz/enigma/command/Command.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/main/java/cuchaz/enigma/command/Command.java') diff --git a/src/main/java/cuchaz/enigma/command/Command.java b/src/main/java/cuchaz/enigma/command/Command.java index d53ed6e..09dd321 100644 --- a/src/main/java/cuchaz/enigma/command/Command.java +++ b/src/main/java/cuchaz/enigma/command/Command.java @@ -13,6 +13,8 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import com.google.common.io.MoreFiles; + public abstract class Command { public final String name; @@ -49,6 +51,8 @@ public abstract class Command { protected static MappingFormat chooseEnigmaFormat(Path path) { if (Files.isDirectory(path)) { return MappingFormat.ENIGMA_DIRECTORY; + } else if ("zip".equalsIgnoreCase(MoreFiles.getFileExtension(path))) { + return MappingFormat.ENIGMA_ZIP; } else { return MappingFormat.ENIGMA_FILE; } -- cgit v1.2.3