diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java index 8af515156b95c38ed9a50fff60ad57f0e4b88c1e..f5f35ccc0e482fb49862db2c4d0f7466eebc5b3e 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java @@ -47,7 +47,8 @@ */ public class Installer extends ModuleInstall { - private static final String LEGACY_DEFAULT_DB_PARENT_PATH = Paths.get(PlatformUtil.getUserDirectory().getAbsolutePath(), "central_repository").toAbsolutePath().toString(); + private static final String LEGACY_DEFAULT_FOLDER = "central_repository"; + private static final String LEGACY_DEFAULT_DB_PARENT_PATH = Paths.get(PlatformUtil.getUserDirectory().getAbsolutePath(), LEGACY_DEFAULT_FOLDER).toAbsolutePath().toString(); //private static final String LEGACY_DEFAULT_DB_NAME = "central_repository.db"; private static final String LEGACY_MODULE_SETTINGS_KEY = "CentralRepository"; @@ -104,8 +105,15 @@ private void upgradeSettingsPath() { if (!newSettingsFile.exists() && legacySettingsFile.exists()) { Map<String, String> prevSettings = ModuleSettings.getConfigSettings(LEGACY_MODULE_SETTINGS_KEY); String prevPath = prevSettings.get(SqliteCentralRepoSettings.getDatabasePathKey()); + File prevDirCheck = new File(prevPath); + // if a relative directory, make sure it is relative to user config. + if (!prevDirCheck.isAbsolute()) { + prevPath = Paths.get(PlatformUtil.getUserDirectory().getAbsolutePath(), prevPath).toAbsolutePath().toString(); + } + // if old path is default path for sqlite db, copy it over to new location and update setting. - if (prevPath != null && Paths.get(LEGACY_DEFAULT_DB_PARENT_PATH).equals(Paths.get(prevPath).toAbsolutePath())) { + if (prevPath != null + && Paths.get(LEGACY_DEFAULT_DB_PARENT_PATH).toAbsolutePath().toString().equals(Paths.get(prevPath).toAbsolutePath().toString())) { String prevDbName = prevSettings.get(SqliteCentralRepoSettings.getDatabaseNameKey()); File prevDir = new File(prevPath); // copy all files starting with prevDbName in prevPath to new path location. diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Installer.java b/Core/src/org/sleuthkit/autopsy/ingest/Installer.java index 3f6aa4802e9018c4671edb355ee9661dcdb10270..19fa852b205c21a344c60b508e60368d6edfe680 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/Installer.java @@ -97,7 +97,8 @@ private void upgradeSettings() { .filter(e -> e.getKey() != null) .collect(Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue() == null ? null : e.getValue().toString(), (v1, v2) -> v1)); - ModuleSettings.setConfigSettings(IngestJobSettings.getModuleSettingsResource(settingsName), moduleSettingsToSave); + String resourceName = isProfile ? IngestProfiles.getExecutionContext(settingsName) : settingsName; + ModuleSettings.setConfigSettings(IngestJobSettings.getModuleSettingsResource(resourceName), moduleSettingsToSave); FileUtils.copyDirectory(moduleSettingsFolder, IngestJobSettings.getSavedModuleSettingsFolder(settingsName).toFile()); } catch (IOException ex) {