Revert "Remove code to search InternalPythonModules from python/JythonModuleLoader"

This reverts commit 6d2c46593266dc99b88bc37480a1830f96a62632.
This commit is contained in:
Richard Cordovano 2016-03-31 16:48:31 -04:00
parent f1fed22825
commit ef501a61f2

View File

@ -68,11 +68,19 @@ public final class JythonModuleLoader {
} }
private static <T> List<T> getInterfaceImplementations(LineFilter filter, Class<T> interfaceClass) { private static <T> List<T> getInterfaceImplementations(LineFilter filter, Class<T> interfaceClass) {
PythonInterpreter interpreter = new PythonInterpreter();
List<T> objects = new ArrayList<>(); List<T> objects = new ArrayList<>();
File pythonModulesDir = new File(PlatformUtil.getUserPythonModulesPath()); Set<File> pythonModuleDirs = new HashSet<>();
File[] files = pythonModulesDir.listFiles(); PythonInterpreter interpreter = new PythonInterpreter();
for (File file : files) {
// add python modules from 'autospy/build/cluster/InternalPythonModules' folder
// which are copied from 'autopsy/*/release/InternalPythonModules' folders.
for (File f : InstalledFileLocator.getDefault().locateAll("InternalPythonModules", JythonModuleLoader.class.getPackage().getName(), false)) { //NON-NLS
Collections.addAll(pythonModuleDirs, f.listFiles());
}
// add python modules from 'testuserdir/python_modules' folder
Collections.addAll(pythonModuleDirs, new File(PlatformUtil.getUserPythonModulesPath()).listFiles());
for (File file : pythonModuleDirs) {
if (file.isDirectory()) { if (file.isDirectory()) {
File[] pythonScripts = file.listFiles(new PythonScriptFileFilter()); File[] pythonScripts = file.listFiles(new PythonScriptFileFilter());
for (File script : pythonScripts) { for (File script : pythonScripts) {