diff --git a/src/main/java/me/coley/recaf/command/impl/Export.java b/src/main/java/me/coley/recaf/command/impl/Export.java index 83ba45491..b00baec45 100644 --- a/src/main/java/me/coley/recaf/command/impl/Export.java +++ b/src/main/java/me/coley/recaf/command/impl/Export.java @@ -4,6 +4,7 @@ import me.coley.recaf.plugin.PluginsManager; import me.coley.recaf.plugin.api.ExportInterceptorPlugin; import me.coley.recaf.util.IOUtil; +import me.coley.recaf.util.Log; import me.coley.recaf.workspace.ClassResource; import me.coley.recaf.workspace.DirectoryResource; import me.coley.recaf.workspace.JavaResource; @@ -16,6 +17,7 @@ import java.io.File; import java.io.IOException; import java.io.OutputStream; +import java.lang.reflect.Field; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -141,6 +143,13 @@ public static void writeArchive(boolean compress, File output, Map dirsVisited = new HashSet<>(); // Contents is iterated in sorted order (because 'archiveContent' is TreeMap). @@ -197,4 +206,20 @@ private void put(Map content, JavaResource res) { content.put(name, e.getValue()); } } + + /** + * A set that discards it's elements upon adding. + * + * This class is used to prevent "Duplcicate zip entry: " + * error + * + * @author xDark + */ + private static final class DiscardingSet extends HashSet { + + @Override + public boolean add(String s) { + return true; + } + } }