GP-873: Fixed a bug that prevented GhidraDev projects from recognizing

extensions
installed in the user's home Extension directory
This commit is contained in:
Ryan Kurtz 2021-04-22 08:55:08 -04:00
parent 1e39c2ac82
commit a503ded1fc
5 changed files with 261 additions and 11 deletions

View file

@ -83,13 +83,20 @@ public class SystemUtilities {
Class<?> myClass = SystemUtilities.class;
ClassLoader loader = myClass.getClassLoader();
if (loader == null) {
// Loaded with the bootstrap class loader...definitely dev mode.
// The Eclipse GhidraDevPlugin does this when it's running from dev mode.
return true;
// Can happen when called from the Eclipse GhidraDev plugin
return false;
}
String name = myClass.getName().replace('.', '/') + ".class";
URL url = loader.getResource(name);
return !"jar".equals(url.getProtocol());
String protocol = loader.getResource(name).getProtocol();
switch(protocol) {
case "file": // Source repository mode (class files)
return true;
case "jar": // Release mode (jar files)
case "bundleresource": // Eclipse GhidraDev mode
return false;
default: // Unexpected protocol...assume a development mode
return true;
}
}
/**