From 294ce8ff9a1edd2b9770a19169c1bdc615d441a3 Mon Sep 17 00:00:00 2001 From: adam-m Date: Thu, 11 Jul 2013 14:57:12 -0400 Subject: [PATCH] Add discovery of external ingest modules (outside of autopsy project tree) in ingest module loader --- .../autopsy/coreutils/PlatformUtil.java | 21 +++++++++++++++++++ .../autopsy/ingest/IngestModuleLoader.java | 10 +++++++++ 2 files changed, 31 insertions(+) diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java b/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java index fd64d080ce..40ced93327 100644 --- a/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java @@ -141,6 +141,27 @@ public class PlatformUtil { public static File getUserDirectory() { return Places.getUserDirectory(); } + + /** + * Get RCP project dirs + * @return + */ + public static List getProjectsDirs() { + List ret = new ArrayList(); + String projectDir = System.getProperty("netbeans.dirs"); + if (projectDir == null) { + return ret; + } + String [] split = projectDir.split(";"); + if (split == null || split.length == 0) { + return ret; + } + for (String path : split) { + ret.add(path); + } + + return ret; + } /** * Get user config directory path diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestModuleLoader.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestModuleLoader.java index 16ccae2b57..df5eceaadf 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestModuleLoader.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestModuleLoader.java @@ -442,6 +442,16 @@ public final class IngestModuleLoader { //user modules urls.addAll(getJarPaths(PlatformUtil.getUserModulesPath())); + + // add other project dirs, such as from external modules + for (String projectDir : PlatformUtil.getProjectsDirs()) { + File modules = new File(projectDir + File.separator + "modules"); + if (modules.exists()) { + urls.addAll(getJarPaths(modules.getAbsolutePath())); + } + } + + return urls; }