diff options
| author | 2020-03-17 23:28:47 +0000 | |
|---|---|---|
| committer | 2020-03-17 23:28:47 +0000 | |
| commit | bfd7bfd739968af5b7bad17134783deedd424f1f (patch) | |
| tree | a9dc7906c88c1c8c40c98f0f97632cd7dd269e25 /src/main/java/cuchaz/enigma/command/Command.java | |
| parent | Fix documenting constructors (#201) (diff) | |
| download | enigma-fork-bfd7bfd739968af5b7bad17134783deedd424f1f.tar.gz enigma-fork-bfd7bfd739968af5b7bad17134783deedd424f1f.tar.xz enigma-fork-bfd7bfd739968af5b7bad17134783deedd424f1f.zip | |
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
Diffstat (limited to 'src/main/java/cuchaz/enigma/command/Command.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/command/Command.java | 4 |
1 files changed, 4 insertions, 0 deletions
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; | |||
| 13 | import java.nio.file.Path; | 13 | import java.nio.file.Path; |
| 14 | import java.nio.file.Paths; | 14 | import java.nio.file.Paths; |
| 15 | 15 | ||
| 16 | import com.google.common.io.MoreFiles; | ||
| 17 | |||
| 16 | public abstract class Command { | 18 | public abstract class Command { |
| 17 | public final String name; | 19 | public final String name; |
| 18 | 20 | ||
| @@ -49,6 +51,8 @@ public abstract class Command { | |||
| 49 | protected static MappingFormat chooseEnigmaFormat(Path path) { | 51 | protected static MappingFormat chooseEnigmaFormat(Path path) { |
| 50 | if (Files.isDirectory(path)) { | 52 | if (Files.isDirectory(path)) { |
| 51 | return MappingFormat.ENIGMA_DIRECTORY; | 53 | return MappingFormat.ENIGMA_DIRECTORY; |
| 54 | } else if ("zip".equalsIgnoreCase(MoreFiles.getFileExtension(path))) { | ||
| 55 | return MappingFormat.ENIGMA_ZIP; | ||
| 52 | } else { | 56 | } else { |
| 53 | return MappingFormat.ENIGMA_FILE; | 57 | return MappingFormat.ENIGMA_FILE; |
| 54 | } | 58 | } |