switching folders during build-windows-installer.xml

This commit is contained in:
Greg DiCristofaro 2020-06-16 14:39:41 -04:00
parent 23c2bbdd6b
commit fa8f6db5a1
98 changed files with 26 additions and 18 deletions

View File

@ -81,8 +81,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
static final boolean DEFAULT_CONFIG_KEEP_CORRUPTED_FILES = false;
private static final String PHOTOREC_DIRECTORY = "photorec_exec"; //NON-NLS
private static final String X64_DIR = "64-bit";
private static final String X86_DIR = "32-bit";
private static final String PHOTOREC_SUBDIRECTORY = "bin"; //NON-NLS
private static final String PHOTOREC_EXECUTABLE = "photorec_win.exe"; //NON-NLS
private static final String PHOTOREC_LINUX_EXECUTABLE = "photorec";
private static final String PHOTOREC_RESULTS_BASE = "results"; //NON-NLS
@ -456,15 +455,6 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
return path;
}
/**
* @return The correct copy of photorec for windows based on processor architecture.
*/
private static Path getWinExecutablePath() {
return Paths.get(
PHOTOREC_DIRECTORY,
PlatformUtil.is64BitOS() ? X64_DIR : X86_DIR,
PHOTOREC_EXECUTABLE);
}
/**
* Finds and returns the path to the executable, if able.
@ -480,11 +470,11 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule {
Path execName;
String photorec_linux_directory = "/usr/bin";
if (PlatformUtil.isWindowsOS()) {
execName = getWinExecutablePath();
execName = Paths.get(PHOTOREC_DIRECTORY, PHOTOREC_SUBDIRECTORY, PHOTOREC_EXECUTABLE);
exeFile = InstalledFileLocator.getDefault().locate(execName.toString(), PhotoRecCarverFileIngestModule.class.getPackage().getName(), false);
} else {
File usrBin = new File("/usr/bin/photorec");
File usrLocalBin = new File("/usr/local/bin/photorec");
File usrLocalBin = new File("/usr/bin/photorec");
if (usrBin.canExecute() && usrBin.exists() && !usrBin.isDirectory()) {
photorec_linux_directory = "/usr/bin";
}else if(usrLocalBin.canExecute() && usrLocalBin.exists() && !usrLocalBin.isDirectory()){

View File

@ -39,7 +39,12 @@
<else>
<echo message="64-bit JRE not found. No 64-bit installer will be built. Set the JRE_HOME_64 environment variable to generate a 64-bit installer."/>
</else>
</if>
</if>
<!-- Where photo rec is installed within installer -->
<var name="photorec-rel-path" value="${app.name}\photorec_exec"/>
<!-- Where the photo rec build folder is placed in the dist folder currently -->
<var name="photorec-inst-path" value="${inst-path}\photorec_exec"/>
</target>
<target name="autoAIPath" description="Attempt to find the AI path based on standard installation location">
@ -110,7 +115,9 @@
<var name="aut-bin-name" value="${app.name}.exe"/>
<var name="gstreamer-path-todelete" value="${app.name}\gstreamer\1.0\x86_64"/>
<var name="photorec-path-todelete" value="${app.name}\photorec_exec\64-bit"/>
<!-- The path to the correct version of photorec to use. -->
<var name="photorec-path-to-use" value="${photorec-inst-path}\bin"/>
<var name="jvm.max.mem" value="512m" />
@ -137,7 +144,9 @@
<var name="aut-bin-name-todelete" value="${app.name}.exe"/>
<var name="gstreamer-path-todelete" value="${app.name}\gstreamer\1.0\x86"/>
<var name="photorec-path-todelete" value="${app.name}\photorec_exec\32-bit"/>
<!-- The path to the correct version of photorec to use. -->
<var name="photorec-path-to-use" value="${photorec-inst-path}\64-bit\bin"/>
<var name="jvm.max.mem" value="4G"/>
@ -198,9 +207,14 @@
<arg line="/edit ${aip-path} /DelFolder APPDIR\${gstreamer-path-todelete}"/>
</exec>
<echo message="Removing extra PhotoRec binaries..."/>
<echo message="Placing correct PhotoRec binaries..."/>
<!-- 'Delete' the folder being relayed to advanced installer for photorec -->
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /DelFolder APPDIR\${photorec-path-todelete}"/>
<arg line="/edit ${aip-path} /DelFolder APPDIR\${photorec-rel-path}"/>
</exec>
<!-- Replace that folder with the subfolder depending on 32-bit vs. 64-bit -->
<exec executable="${ai-exe-path}">
<arg line="/edit ${aip-path} /AddFolder APPDIR\${photorec-rel-path} ${photorec-path-to-use}"/>
</exec>
</target>

4
thirdparty/photorec_exec/README.txt vendored Normal file
View File

@ -0,0 +1,4 @@
The 'bin' folder is the version used when running the PhotoRec ingest module. It is also the 32-bit version.
When the 64-bit version of the installer is created, the photorec_exec/64-bit/bin folder is placed at photorec_exec/bin.
When the 32-bit version of the installer is created, the photorec_exec/64-bit folder is deleted.
See 'build-windows-installer.xml' for more details.