Add fix to restore directory when running as admin

This commit is contained in:
Ann Priestman 2018-01-09 09:44:27 -05:00
parent a055757c64
commit 00e68c44aa

View File

@ -73,10 +73,6 @@ public final class CreateLiveTriageDriveAction extends CallableSystemAction {
String installPath = PlatformUtil.getInstallPath(); String installPath = PlatformUtil.getInstallPath();
Path exePath = Paths.get(installPath, "bin", exeName); Path exePath = Paths.get(installPath, "bin", exeName);
System.out.println("Exe expected at " + exePath);
// TEMP for testing - allows this to run from Netbeans
exePath = Paths.get("C:\\Program Files\\Autopsy-4.5.0", "bin", exeName);
if (!exePath.toFile().exists()) { if (!exePath.toFile().exists()) {
JOptionPane.showMessageDialog(mainWindow, JOptionPane.showMessageDialog(mainWindow,
@ -193,6 +189,11 @@ public final class CreateLiveTriageDriveAction extends CallableSystemAction {
String batchFile String batchFile
= "@echo off\n" = "@echo off\n"
+ "\n"
+ "REM This restores the working directory when using 'Run as administrator'"
+ "@setlocal enableextensions\n"
+ "@cd /d \"%~dp0\""
+ "\n"
+ "SET appName=\"" + appName + "\"\n" + "SET appName=\"" + appName + "\"\n"
+ "\n" + "\n"
+ "REM Create the configData directory. Exit if it does not exist after attempting to create it\n" + "REM Create the configData directory. Exit if it does not exist after attempting to create it\n"