diff --git a/Core/build.xml b/Core/build.xml index 4b6c32d56d..8a7c54e407 100644 --- a/Core/build.xml +++ b/Core/build.xml @@ -40,6 +40,24 @@ + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/core/Installer.java b/Core/src/org/sleuthkit/autopsy/core/Installer.java index 2f65b6099b..83f8d175e8 100644 --- a/Core/src/org/sleuthkit/autopsy/core/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/core/Installer.java @@ -18,9 +18,12 @@ */ package org.sleuthkit.autopsy.core; +import com.sun.jna.platform.win32.Kernel32; import java.awt.Cursor; import java.io.File; import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; @@ -74,6 +77,8 @@ public class Installer extends ModuleInstall { */ if (PlatformUtil.isWindowsOS()) { try { + addGstreamerPathsToEnv(); + //Note: if shipping with a different CRT version, this will only print a warning //and try to use linker mechanism to find the correct versions of libs. //We should update this if we officially switch to a new version of CRT/compiler @@ -271,6 +276,43 @@ public class Installer extends ModuleInstall { } } + /** + * Add the Gstreamer bin and lib paths to the PATH environment variable so + * that the correct plugins and libraries are found when Gstreamer is + * initialized later. + */ + private static void addGstreamerPathsToEnv() { + Path gstreamerPath = InstalledFileLocator.getDefault().locate("gstreamer", Installer.class.getPackage().getName(), false).toPath(); + + if (gstreamerPath == null) { + logger.log(Level.SEVERE, "Failed to find GStreamer."); + } else { + String arch = "x86_64"; + if (!PlatformUtil.is64BitJVM()) { + arch = "x86"; + } + + Path gstreamerBasePath = Paths.get(gstreamerPath.toString(), "1.0", arch); + Path gstreamerBinPath = Paths.get(gstreamerBasePath.toString(), "bin"); + Path gstreamerLibPath = Paths.get(gstreamerBasePath.toString(), "lib", "gstreamer-1.0"); + + // Update the PATH environment variable to contain the GStreamer + // lib and bin paths. + Kernel32 k32 = Kernel32.INSTANCE; + String path = System.getenv("PATH"); + if (path == null || path.trim().isEmpty()) { + k32.SetEnvironmentVariable("PATH", gstreamerLibPath.toString()); + } else { + /* + * Note that we *prepend* the paths so that the Gstreamer + * binaries associated with the current release are found rather + * than binaries associated with an earlier version of Autopsy. + */ + k32.SetEnvironmentVariable("PATH", gstreamerBinPath.toString() + File.pathSeparator + gstreamerLibPath.toString() + path); + } + } + } + /** * Make a folder in the config directory for object detection classifiers if one does not * exist. @@ -288,7 +330,7 @@ public class Installer extends ModuleInstall { File pythonModulesDir = new File(PlatformUtil.getUserPythonModulesPath()); pythonModulesDir.mkdir(); } - + /** * Make a folder in the config directory for Ocr Language Packs if one does * not exist. @@ -296,10 +338,10 @@ public class Installer extends ModuleInstall { private static void ensureOcrLanguagePacksFolderExists() { File ocrLanguagePacksDir = new File(PlatformUtil.getOcrLanguagePacksPath()); boolean createDirectory = ocrLanguagePacksDir.mkdir(); - + //If the directory did not exist, copy the tessdata folder over so we //support english. - if(createDirectory) { + if (createDirectory) { File tessdataDir = InstalledFileLocator.getDefault().locate( "Tesseract-OCR/tessdata", Installer.class.getPackage().getName(), false); try { diff --git a/build-windows-installer.xml b/build-windows-installer.xml index 61f006a5a3..1cd7a54cb7 100644 --- a/build-windows-installer.xml +++ b/build-windows-installer.xml @@ -117,16 +117,15 @@ - - - - - - + + + - + - + + + @@ -153,48 +152,19 @@ - - - - - - + + + - + - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - +