mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Added GStreamer paths to PATH environment variable on Windows so that we can find the correct version even if there is more than one version of Autopsy installed.
This commit is contained in:
parent
90ec9f5191
commit
3c1789463c
@ -40,6 +40,24 @@
|
||||
<fileset dir="${thirdparty.dir}/Tesseract-OCR"/>
|
||||
</copy>
|
||||
|
||||
<!--Copy GStreamer to release-->
|
||||
<copy todir="${basedir}/release/gstreamer" >
|
||||
<fileset dir="${thirdparty.dir}/gstreamer"/>
|
||||
</copy>
|
||||
|
||||
<!-- The 'libgstlibav.dll' file is too big to store on GitHub, so we
|
||||
have it stored in a ZIP file. We'll extract it in place and remove
|
||||
the ZIP file afterward. -->
|
||||
<var name="gstreamer-base-path" value="${basedir}/release/gstreamer/1.0/" />
|
||||
|
||||
<unzip src="${gstreamer-base-path}/x86_64/lib/gstreamer-1.0/libgstlibav.zip"
|
||||
dest="${gstreamer-base-path}/x86_64/lib/gstreamer-1.0/"/>
|
||||
<delete file="${gstreamer-base-path}/x86_64/lib/gstreamer-1.0/libgstlibav.zip" />
|
||||
|
||||
<unzip src="${gstreamer-base-path}/x86/lib/gstreamer-1.0/libgstlibav.zip"
|
||||
dest="${gstreamer-base-path}/x86/lib/gstreamer-1.0/"/>
|
||||
<delete file="${gstreamer-base-path}/x86/lib/gstreamer-1.0/libgstlibav.zip" />
|
||||
|
||||
<!--Copy other jars-->
|
||||
<copy file="${thirdparty.dir}/rejistry/Rejistry-1.0-SNAPSHOT.jar" todir="${ext.dir}" />
|
||||
<copy file="${thirdparty.dir}/sevenzip/sevenzipjbinding.jar" todir="${ext.dir}" />
|
||||
|
@ -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.
|
||||
|
@ -118,15 +118,14 @@
|
||||
<arg line="/edit ${aip-path-base} /SetAppdir -buildname DefaultBuild -path [ProgramFilesFolder][ProductName]-${app.version}"/>
|
||||
</exec>
|
||||
|
||||
<var name="gstreamer-relative-path" value="gstreamer/1.0/x86"/>
|
||||
<antcall target="install-gstreamer" inheritAll="true" />
|
||||
<!-- Delete the 64 bit version of gstreamer since its not needed by the 32 bit installer -->
|
||||
<var name="gstreamer-relative-path" value="gstreamer/1.0/x86_64"/>
|
||||
<delete includeEmptyDirs="true">
|
||||
<fileset dir="${inst-path}/autopsy/${gstreamer-relative-path}"/>
|
||||
</delete>
|
||||
|
||||
<antcall target="ai-build" inheritAll="true" />
|
||||
|
||||
<delete includeEmptyDirs="true">
|
||||
<fileset dir="${inst-path}/${app.name}/${gstreamer-relative-path}"/>
|
||||
</delete>
|
||||
|
||||
<delete dir="${nbdist.dir}/installer_${app.name}_32-cache"/>
|
||||
<move file="${nbdist.dir}/installer_${app.name}_32-SetupFiles/installer_${app.name}_32.msi" tofile="${nbdist.dir}/${app.name}-${app.version}-32bit.msi" />
|
||||
</target>
|
||||
@ -154,47 +153,18 @@
|
||||
<arg line="/edit ${aip-path} /SetPackageType x64"/>
|
||||
</exec>
|
||||
|
||||
<var name="gstreamer-relative-path" value="gstreamer/1.0/x86_64"/>
|
||||
<antcall target="install-gstreamer" inheritAll="true" />
|
||||
<!-- Delete the 32 bit version of gstreamer since its not needed by the 64 bit installer -->
|
||||
<var name="gstreamer-relative-path" value="gstreamer/1.0/x86"/>
|
||||
<delete includeEmptyDirs="true">
|
||||
<fileset dir="${inst-path}/autopsy/${gstreamer-relative-path}"/>
|
||||
</delete>
|
||||
|
||||
<antcall target="ai-build" inheritAll="true" />
|
||||
|
||||
<delete includeEmptyDirs="true">
|
||||
<fileset dir="${inst-path}/${app.name}/${gstreamer-relative-path}"/>
|
||||
</delete>
|
||||
|
||||
<delete dir="${nbdist.dir}/installer_${app.name}_64-cache"/>
|
||||
<move file="${nbdist.dir}/installer_${app.name}_64-SetupFiles/installer_${app.name}_64.msi" tofile="${nbdist.dir}/${app.name}-${app.version}-64bit.msi" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="install-gstreamer" description="Install a copy of GStreamer.">
|
||||
<!-- Make GStreamer available to the installer -->
|
||||
<mkdir dir="${inst-path}/${app.name}/${gstreamer-relative-path}"/>
|
||||
<copy todir="${inst-path}/${app.name}/${gstreamer-relative-path}" >
|
||||
<fileset dir="${thirdparty.dir}/${gstreamer-relative-path}"/>
|
||||
</copy>
|
||||
|
||||
<!-- The 'libgstlibav.dll' file is too big to store on GitHub, so we
|
||||
have it stored in a ZIP file. We'll extract it in place and remove
|
||||
the ZIP file afterward. -->
|
||||
<unzip src="${inst-path}/${app.name}/${gstreamer-relative-path}/lib/gstreamer-1.0/libgstlibav.zip"
|
||||
dest="${inst-path}/${app.name}/${gstreamer-relative-path}/lib/gstreamer-1.0/"/>
|
||||
<delete file="${inst-path}/${app.name}/${gstreamer-relative-path}/lib/gstreamer-1.0/libgstlibav.zip" />
|
||||
|
||||
<!-- GStreamer needs special path info to be set -->
|
||||
<exec executable="${ai-exe-path}">
|
||||
<arg line="/edit ${aip-path} /NewEnvironment -name GSTREAMER_PATH -value [APPDIR]${app.name}\${gstreamer-relative-path}\bin -install_operation CreateUpdate -behavior Append -system_variable"/>
|
||||
</exec>
|
||||
<exec executable="${ai-exe-path}">
|
||||
<arg line="/edit ${aip-path} /NewEnvironment -name GSTREAMER_PATH -value [APPDIR]${app.name}\${gstreamer-relative-path}\lib\gstreamer-1.0 -install_operation CreateUpdate -behavior Append -system_variable"/>
|
||||
</exec>
|
||||
<exec executable="${ai-exe-path}">
|
||||
<arg line="/edit ${aip-path} /NewEnvironment -name PATH -value %GSTREAMER_PATH% -install_operation CreateUpdate -behavior Append -system_variable"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- 32/64 specific since config settings are different -->
|
||||
<target name="update-config" description="Updates configuration file with correct JVM args.">
|
||||
<!-- Update configuration file to include jre -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user