Fixes URL encoded path returned by resource.getFile() (#8865)

This commit is contained in:
Kok Wai Gie 2022-10-08 20:32:37 +08:00 committed by GitHub
parent 3a8d44820f
commit e256ebefa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,8 @@ package mage.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.*;
import java.util.jar.JarEntry;
@ -43,6 +45,11 @@ public final class ClassScanner {
filePath = filePath.substring("file:".length(), filePath.lastIndexOf('!'));
jars.add(filePath);
} else {
try {
filePath = resource.toURI().getPath();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
dirs.put(filePath, packageName);
}
}