diff --git a/gradle.properties b/gradle.properties index 95519fc..6c28d3f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ version = 0.3.1 -snapshot = true +snapshot = false archive_name = resource-tools diff --git a/src/main/java/cc/sukazyo/restools/impl/jar/tree/NodeRoot.java b/src/main/java/cc/sukazyo/restools/impl/jar/tree/NodeRoot.java index a702204..f60c204 100644 --- a/src/main/java/cc/sukazyo/restools/impl/jar/tree/NodeRoot.java +++ b/src/main/java/cc/sukazyo/restools/impl/jar/tree/NodeRoot.java @@ -12,6 +12,7 @@ public class NodeRoot implements IBranchNode { @Nonnull public final JarFile jar; final Map _children = new HashMap<>(); + final Map _dangling_entries = new HashMap<>(); public NodeRoot (@Nonnull JarFile jar) { this.jar = jar; @@ -41,6 +42,11 @@ public Map children () { return _children; } + @Nonnull + public Map getDanglingEntries () { + return _dangling_entries; + } + @Nonnull @Override public String getAbsolutePath () { diff --git a/src/main/java/cc/sukazyo/restools/impl/jar/tree/Parser.java b/src/main/java/cc/sukazyo/restools/impl/jar/tree/Parser.java index 6da6c0d..bc89f00 100644 --- a/src/main/java/cc/sukazyo/restools/impl/jar/tree/Parser.java +++ b/src/main/java/cc/sukazyo/restools/impl/jar/tree/Parser.java @@ -27,8 +27,13 @@ public static NodeRoot parse (@Nonnull JarFile jar) { final List newUnresolvedEntries = new ArrayList<>(); unresolvedEntries.forEach(entry -> resolveEntry(root, entry, newUnresolvedEntries)); - if (unresolvedEntries.size() == newUnresolvedEntries.size()) - throw new IllegalStateException("Failed to resolve all entries due to thw following entries have no parents: " + unresolvedEntries); + if (unresolvedEntries.size() == newUnresolvedEntries.size()) { +// throw new IllegalStateException("Failed to resolve all entries due to thw following entries have no parents: " + unresolvedEntries); + for (JarEntry entry : newUnresolvedEntries) { + root._dangling_entries.put(entry.getName(), entry); + } + break; + } unresolvedEntries = newUnresolvedEntries; } diff --git a/src/main/java/cc/sukazyo/restools/utils/PathsHelper.java b/src/main/java/cc/sukazyo/restools/utils/PathsHelper.java index 9493bb2..cf7b73a 100644 --- a/src/main/java/cc/sukazyo/restools/utils/PathsHelper.java +++ b/src/main/java/cc/sukazyo/restools/utils/PathsHelper.java @@ -32,7 +32,7 @@ public class PathsHelper { */ @Nonnull public static String getJarPath (@Nonnull String path) { - final int jarIdentifier = path.lastIndexOf("/") - 1; + final int jarIdentifier = path.lastIndexOf("!/"); if (jarIdentifier > 0 && path.startsWith("jar:")) return path.substring("jar:".length(), jarIdentifier); else return path;