GT-3547 - Patch dir fix - review fixes

This commit is contained in:
dragonmacher 2020-02-24 11:00:51 -05:00
parent 87bda2b34d
commit 855955bb3d
3 changed files with 23 additions and 20 deletions

View File

@ -94,21 +94,24 @@ class ClassJar extends ClassLocation {
//
//
// Dev Mode
// Dev Mode - don't scan 3rd-party jar files
//
if (pathName.contains("ExternalLibraries")) {
return true;
}
//
// Dev and Production Mode
//
String forwardSlashedPathName = pathName.replaceAll("\\\\", "/");
if (isUserPluginJar(forwardSlashedPathName)) {
// Dev Mode - let everything else through
//
if (SystemUtilities.isInDevelopmentMode()) {
return false;
}
if (SystemUtilities.isInDevelopmentMode()) {
//
// Production Mode - old style (before Extensions) of user contributions
//
String forwardSlashedPathName = pathName.replaceAll("\\\\", "/");
if (isUserPluginJar(forwardSlashedPathName)) {
return false;
}
@ -120,12 +123,13 @@ class ClassJar extends ClassLocation {
}
//
// Production Mode - In production, only module lib jar files are scanned.
// Production Mode - In production, only module lib jar files are scanned
//
if (isModuleDependencyJar(forwardSlashedPathName)) {
return false;
}
// this is typically a 3rd-party jar file
return true;
}

View File

@ -87,10 +87,10 @@ public class GhidraLauncher {
* the classpath.
*
* @param pathList The list of paths to add to
* @param patchDir The application installation directory
* @param patchDir The application installation directory; may be null
*/
private static void addPatchPaths(List<String> pathList, ResourceFile patchDir) {
if (!patchDir.exists()) {
if (patchDir == null || !patchDir.exists()) {
return;
}

View File

@ -1,13 +1,12 @@
Compiled Java class files, either inside of a jar file or in a directory structure may be inserted
into this directory. This directory and the contained jar files will be prepended to
the classpath, allowing them to override any existing classes in any module (except those from
the Utility module).
The jar files will be sorted by name before being added to the classpath in order to present
predictable class loading between Ghidra runs. This directory will be prepended on the classpath
before any jar files, given the classes in this directory precedence over the jar files.
The class files in this directory must be in a directory structure that matches their respective
packages.
This directory exits so that Ghidra releases can be patched, or overridden.
Classes or jar files placed in this directory will found and loaded
*before* the classes that exist in the release jar files. One exception
is that classes in the Utility module can not be patched in this way.
The jar files will be sorted by name before being prepended to the classpath
in order to have predictable class loading between Ghidra runs. This patch
directory will be the very first patch entry on the classpath such that any
individual classes will be found before classes in any of the patch jar files.
The class files in this directory must be in the standard java package
directory structure.