Fix file path formatting bug in Injector.java

This commit is contained in:
Gabriel Tofvesson 2021-04-02 08:07:13 +02:00
parent 58982c8f99
commit ee1ab4191c

View File

@ -9,6 +9,8 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Objects; import java.util.Objects;
@ -25,7 +27,10 @@ public class Injector {
public static void injectAll(ClassLoader loader, Combine merger) throws IOException { public static void injectAll(ClassLoader loader, Combine merger) throws IOException {
Enumeration<URL> resources = loader.getResources(""); Enumeration<URL> resources = loader.getResources("");
while (resources.hasMoreElements()) while (resources.hasMoreElements())
injectDirectory(new File(resources.nextElement().getPath()), merger); injectDirectory(new File(URLDecoder.decode(
resources.nextElement().getFile(),
StandardCharsets.UTF_8.name())
), merger);
} }
public static void injectAll(Combine merger) throws IOException { public static void injectAll(Combine merger) throws IOException {