Fix not detecting classes when spigot is launch-wrapped.
This commit is contained in:
parent
ffe78c8f37
commit
3595f859fe
@ -51,20 +51,24 @@ public class ClassGetter {
|
|||||||
|
|
||||||
// Get a File object for the package
|
// Get a File object for the package
|
||||||
CodeSource src = runFrom.getProtectionDomain().getCodeSource();
|
CodeSource src = runFrom.getProtectionDomain().getCodeSource();
|
||||||
|
|
||||||
if (src != null) {
|
if (src != null) {
|
||||||
URL resource = src.getLocation();
|
URL resource = src.getLocation();
|
||||||
|
boolean isInsideJar = resource.getPath().toLowerCase(Locale.ENGLISH).contains(".jar!") && resource.getPath().toLowerCase(Locale.ENGLISH).endsWith(".class");
|
||||||
if (resource.getPath().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
|
if (resource.getPath().toLowerCase(Locale.ENGLISH).endsWith(".jar") || isInsideJar) {
|
||||||
processJarfile(resource, pkgname, classes);
|
processJarfile(resource, pkgname, classes);
|
||||||
} else {
|
} else {
|
||||||
for (File f : new File(resource.getPath() + "/" + pkgname.replace(".", "/")).listFiles()) {
|
File[] baseFileList = new File(resource.getPath() + "/" + pkgname.replace(".", "/")).listFiles();
|
||||||
|
if (baseFileList != null) {
|
||||||
|
for (File f : baseFileList){
|
||||||
if (f.getName().contains("$")) {
|
if (f.getName().contains("$")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
classes.add(pkgname + "/" + f.getName());
|
classes.add(pkgname + "/" + f.getName());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println("File not found for: " + resource.getPath() + "/" + pkgname.replace(".", "/"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user