GT-3350: Consistently ordered classpath and ExtensionPoint priorities

This commit is contained in:
Ryan Kurtz 2019-11-22 11:35:56 -05:00
parent 7ab75e411e
commit 8f00152601
52 changed files with 341 additions and 169 deletions

View file

@ -26,6 +26,7 @@ import ghidra.util.Msg;
import ghidra.util.SystemUtilities;
import ghidra.util.exception.AssertException;
import utilities.util.FileUtilities;
import utility.application.ApplicationLayout;
/**
* Utility methods for module related things.
@ -334,4 +335,21 @@ public class ModuleUtilities {
}
return findRepo(f.getParentFile());
}
/**
* Checks to see if the given {@link GModule module} is external to the Ghidra installation
* directory
*
* @param module the module to check
* @param layout Ghidra's layout
* @return true if the given {@link GModule module} is external to the Ghidra installation
* directory
*/
public static boolean isExternalModule(GModule module, ApplicationLayout layout) {
File moduleRootDir = module.getModuleRoot().getFile(false);
return !layout.getApplicationRootDirs()
.stream()
.map(dir -> dir.getParentFile().getFile(false))
.anyMatch(dir -> FileUtilities.isPathContainedWithin(dir, moduleRootDir));
}
}