mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
Possible fix for MacOS classloader issue.
This commit is contained in:
parent
1fef6e6bb4
commit
57e2b94205
1 changed files with 5 additions and 4 deletions
|
@ -157,7 +157,7 @@ public abstract class ExpansionSet implements Serializable {
|
|||
private List<Card> getCardClassesForPackage(String packageName) {
|
||||
ClassLoader classLoader = this.getClass().getClassLoader();
|
||||
assert classLoader != null;
|
||||
String path = packageName.replace('.', '/');
|
||||
String path = packageName.replace(".", File.separator);
|
||||
Enumeration<URL> resources = null;
|
||||
try {
|
||||
resources = classLoader.getResources(path);
|
||||
|
@ -185,9 +185,10 @@ public abstract class ExpansionSet implements Serializable {
|
|||
if (jarPath.contains("!")) {
|
||||
jarPath = jarPath.substring(0, jarPath.lastIndexOf('!'));
|
||||
}
|
||||
if (jarPath.startsWith("file:/")) {
|
||||
String filePathElement = "file:" + File.separator;
|
||||
if (jarPath.startsWith(filePathElement)) {
|
||||
try {
|
||||
jarPath = URLDecoder.decode(jarPath.substring(jarPath.indexOf("file:/") + "file:/".length()), "UTF-8");
|
||||
jarPath = URLDecoder.decode(jarPath.substring(jarPath.indexOf(filePathElement) + filePathElement.length()), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.fatal("Error decoding file - " + jarPath, e);
|
||||
}
|
||||
|
@ -257,7 +258,7 @@ public abstract class ExpansionSet implements Serializable {
|
|||
break;
|
||||
}
|
||||
if ((jarEntry.getName().startsWith(packageName)) && (jarEntry.getName().endsWith(".class"))) {
|
||||
String clazz = jarEntry.getName().replaceAll("/", "\\.").replace(".class", "");
|
||||
String clazz = jarEntry.getName().replaceAll(File.separator, "\\.").replace(".class", "");
|
||||
Class c = cl.loadClass(clazz);
|
||||
if (CardImpl.class.isAssignableFrom(c)) {
|
||||
classes.add(c);
|
||||
|
|
Loading…
Reference in a new issue