From 2b46b377ffdda15ec0b17bcdd82e7df1ab3c2208 Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Thu, 2 Jun 2022 19:27:33 -0400 Subject: [PATCH 1/2] central repo fix --- .../autopsy/centralrepository/eventlisteners/Installer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java index 641ec293e3..6418e97791 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java @@ -128,8 +128,10 @@ public class Installer extends ModuleInstall { } } + // get the new relative path to store + String newRelPath = PlatformUtil.getUserDirectory().toPath().relativize(Paths.get(CentralRepoSettings.getInstance().getDefaultDbPath())).toString(); // update path settings accordingly - prevSettings.put(CentralRepoSettings.getInstance().getDatabasePathKey(), CentralRepoSettings.getInstance().getDefaultDbPath()); + prevSettings.put(CentralRepoSettings.getInstance().getDatabasePathKey(), newRelPath); } // copy settings From b7af4b771c1677d8136f6976423cb45569bad9d5 Mon Sep 17 00:00:00 2001 From: Greg DiCristofaro Date: Wed, 8 Jun 2022 13:37:15 -0400 Subject: [PATCH 2/2] module config updates --- .../AddImageWizardIngestConfigPanel.java | 5 +- .../CentralRepoSettings.java | 7 +- .../eventlisteners/Installer.java | 20 ++++- .../autopsy/core/UserPreferences.java | 6 +- .../core/configpath/SharedConfigPath.java | 80 ------------------- .../autopsy/coreutils/PlatformUtil.java | 9 +++ .../autopsy/ingest/IngestJobSettings.java | 6 +- .../autopsy/ingest/IngestProfiles.java | 16 ++-- .../ingest/profile/IngestProfilePaths.java | 48 +++++++++++ .../infrastructure/HashConfigPaths.java | 4 +- .../interestingitems/FilesSetsManager.java | 11 ++- .../infrastructure/ReportingConfigLoader.java | 3 +- .../configuration/SharedConfiguration.java | 2 +- 13 files changed, 102 insertions(+), 115 deletions(-) delete mode 100644 Core/src/org/sleuthkit/autopsy/core/configpath/SharedConfigPath.java create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/profile/IngestProfilePaths.java diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java index e3cd384428..7097b592c3 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java @@ -28,11 +28,10 @@ import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; import org.openide.util.NbBundle.Messages; import org.openide.windows.WindowManager; -import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; +import org.sleuthkit.autopsy.ingest.profile.IngestProfilePaths; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; -import org.sleuthkit.autopsy.ingest.IngestProfiles; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.IngestProfileSelectionWizardPanel; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescriptorPanel; @@ -192,7 +191,7 @@ class AddImageWizardIngestConfigPanel extends ShortcutWizardDescriptorPanel { //Because this panel kicks off ingest during the wizard we need to //swap out the ingestJobSettings for the ones of the chosen profile before //use prefix to specify correct execution context for profiles. - IngestJobSettings ingestJobSettings = new IngestJobSettings(SharedConfigPath.getInstance().getIngestProfilePrefix() + lastProfileUsed); + IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestProfilePaths.getInstance().getIngestProfilePrefix() + lastProfileUsed); progressPanel.setIngestJobSettings(ingestJobSettings); //prepare ingest for being started } } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoSettings.java index 57bdb79987..b7ec071f27 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoSettings.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/CentralRepoSettings.java @@ -18,8 +18,9 @@ */ package org.sleuthkit.autopsy.centralrepository; +import java.io.File; import java.nio.file.Paths; -import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; +import org.sleuthkit.autopsy.coreutils.PlatformUtil; /** * Location for central repo settings and paths. @@ -38,13 +39,13 @@ public class CentralRepoSettings { private static final String CENTRAL_REPOSITORY_FOLDER = "CentralRepository"; private static final String CENTRAL_REPOSITORY_SETTINGS_NAME = "CentralRepository"; private static final String CENTRAL_REPO_BASE_PATH = Paths.get( - SharedConfigPath.getInstance().getSharedConfigPath(), + PlatformUtil.getModuleConfigDirectory(), CENTRAL_REPOSITORY_FOLDER).toString(); private static final String DEFAULT_DB_PARENT_PATH = Paths.get(CENTRAL_REPO_BASE_PATH, "LocalDatabase").toString(); private static final String DEFAULT_DB_NAME = "central_repository.db"; private static final String MODULE_SETTINGS_KEY = Paths.get( - SharedConfigPath.getInstance().getSharedConfigFolder(), + Paths.get(PlatformUtil.getUserConfigDirectory()).relativize(Paths.get(PlatformUtil.getModuleConfigDirectory())).toString(), CENTRAL_REPOSITORY_FOLDER, CENTRAL_REPOSITORY_SETTINGS_NAME).toString(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java index 6418e97791..f15dec3029 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/Installer.java @@ -32,11 +32,9 @@ import org.openide.util.NbBundle; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbChoice; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; -import org.sleuthkit.autopsy.centralrepository.datamodel.SqliteCentralRepoSettings; import org.sleuthkit.autopsy.centralrepository.CentralRepoSettings; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.core.UserPreferences; -import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.PlatformUtil; @@ -94,13 +92,27 @@ public class Installer extends ModuleInstall { upgradeSettingsPath(); setupDefaultCentralRepository(); } + + + + /** + * Path to module settings path. + * + * @param moduleName The full name of the module provided to ModuleSettings. + * + * @return The path on disk for that object. NOTE: This must be in sync with + * ModuleSettings. + */ + private String getSettingsFilePath(String moduleName) { + return Paths.get(PlatformUtil.getUserConfigDirectory(), moduleName + ".properties").toString(); + } /** * Copies settings to new path location. */ private void upgradeSettingsPath() { - File newSettingsFile = new File(SharedConfigPath.getInstance().getSettingsFilePath(CentralRepoSettings.getInstance().getModuleSettingsKey())); - File legacySettingsFile = new File(SharedConfigPath.getInstance().getSettingsFilePath(LEGACY_MODULE_SETTINGS_KEY)); + File newSettingsFile = new File(getSettingsFilePath(CentralRepoSettings.getInstance().getModuleSettingsKey())); + File legacySettingsFile = new File(getSettingsFilePath(LEGACY_MODULE_SETTINGS_KEY)); // new config has not been created, but legacy has, copy it. if (!newSettingsFile.exists() && legacySettingsFile.exists()) { Map prevSettings = ModuleSettings.getConfigSettings(LEGACY_MODULE_SETTINGS_KEY); diff --git a/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java b/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java index 710a3f54fe..cee09547a3 100644 --- a/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java +++ b/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java @@ -30,12 +30,10 @@ import java.util.prefs.BackingStoreException; import org.sleuthkit.autopsy.events.MessageServiceConnectionInfo; import java.util.prefs.PreferenceChangeListener; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; import org.openide.util.Lookup; import org.python.icu.util.TimeZone; import org.sleuthkit.autopsy.appservices.AutopsyService; -import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; import org.sleuthkit.autopsy.machinesettings.UserMachinePreferences; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.PlatformUtil; @@ -71,7 +69,7 @@ public final class UserPreferences { * @return The path to the preference file. */ private static String getSharedPreferencePath(String identifier) { - return Paths.get(SharedConfigPath.getInstance().getSharedConfigPath(), identifier + ".properties").toString(); + return Paths.get(PlatformUtil.getModuleConfigDirectory(), identifier + ".properties").toString(); } private static final String VIEW_PREFERENCE_PATH = getSharedPreferencePath("ViewPreferences"); @@ -88,7 +86,7 @@ public final class UserPreferences { // perform initial load to ensure disk preferences are loaded try { // make shared directory paths if they don't exist. - new File(SharedConfigPath.getInstance().getSharedConfigPath()).mkdirs(); + new File(PlatformUtil.getModuleConfigDirectory()).mkdirs(); viewPreferences.load(); machineSpecificPreferences.load(); modePreferences.load(); diff --git a/Core/src/org/sleuthkit/autopsy/core/configpath/SharedConfigPath.java b/Core/src/org/sleuthkit/autopsy/core/configpath/SharedConfigPath.java deleted file mode 100644 index ad0c490e1d..0000000000 --- a/Core/src/org/sleuthkit/autopsy/core/configpath/SharedConfigPath.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2022 Basis Technology Corp. - * Contact: carrier sleuthkit org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sleuthkit.autopsy.core.configpath; - -import java.nio.file.Paths; -import org.sleuthkit.autopsy.coreutils.PlatformUtil; - -/** - * Path to sharable config. - */ -public class SharedConfigPath { - - private static final SharedConfigPath instance = new SharedConfigPath(); - - private static final String SHARED_FOLDER = "SharableConfig"; - private static final String SHARED_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), SHARED_FOLDER).toAbsolutePath().toString(); - private static final String INGEST_PROFILE_PREFIX = "IngestProfiles."; - - private SharedConfigPath() { - } - - /** - * @return An instance of this class. - */ - public static SharedConfigPath getInstance() { - return instance; - } - - /** - * @return The path to a folder for config items that can be shared between - * different instances. - */ - public String getSharedConfigPath() { - return SHARED_PATH; - } - - /** - * @return The folder in user config for shared config. - */ - public String getSharedConfigFolder() { - return SHARED_FOLDER; - } - - /** - * Path to module settings path. - * - * @param moduleName The full name of the module provided to ModuleSettings. - * - * @return The path on disk for that object. NOTE: This must be in sync with - * ModuleSettings. - */ - public String getSettingsFilePath(String moduleName) { - return Paths.get(PlatformUtil.getUserConfigDirectory(), moduleName + ".properties").toString(); - } - - /** - * @return The prefix in front of all ingest profiles to differentiate - * between this and other ingest settings (i.e. command line, add - * image ingest wizard, etc.). - */ - public String getIngestProfilePrefix() { - return INGEST_PROFILE_PREFIX; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java b/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java index 9aae3292c3..fada0b0eab 100644 --- a/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/PlatformUtil.java @@ -230,6 +230,15 @@ public class PlatformUtil { return Places.getUserDirectory() + File.separator + "config"; //NON-NLS } + /** + * Get module config directory path + * + * @return Get module config directory path string + */ + public static String getModuleConfigDirectory() { + return Paths.get(getUserConfigDirectory(), "ModuleConfig").toString(); + } + /** * Get log directory path * diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 96422fcac6..85052e0aed 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -36,9 +36,9 @@ import java.util.logging.Level; import org.openide.util.NbBundle; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; -import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; +import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet; import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager; import org.sleuthkit.autopsy.python.FactoryClassNameNormalizer; @@ -54,12 +54,12 @@ public final class IngestJobSettings { private static final String MODULE_SETTINGS_FOLDER_NAME = "IngestSettings"; //NON-NLS private static final String MODULE_SETTINGS_FOLDER = Paths.get( - SharedConfigPath.getInstance().getSharedConfigFolder(), + Paths.get(PlatformUtil.getUserConfigDirectory()).relativize(Paths.get(PlatformUtil.getModuleConfigDirectory())).toString(), MODULE_SETTINGS_FOLDER_NAME ).toString(); private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get( - SharedConfigPath.getInstance().getSharedConfigPath(), + PlatformUtil.getModuleConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER_NAME ).toAbsolutePath().toString(); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java index e00465c0cc..a821f418de 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java @@ -18,18 +18,19 @@ */ package org.sleuthkit.autopsy.ingest; -import com.google.common.annotations.Beta; import java.io.File; import java.io.IOException; import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; -import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; +import org.sleuthkit.autopsy.ingest.profile.IngestProfilePaths; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; +import org.sleuthkit.autopsy.coreutils.PlatformUtil; /** * Class for managing the access to the @@ -39,7 +40,7 @@ public final class IngestProfiles { private static final String PROFILE_NAME_KEY = "Profile_Name"; private static final String PROFILE_DESC_KEY = "Profile_Description"; private static final String PROFILE_FILTER_KEY = "Profile_Filter"; - private static final String SETTINGS_FILE_PREFIX = SharedConfigPath.getInstance().getIngestProfilePrefix(); + private static final String SETTINGS_FILE_PREFIX = IngestProfilePaths.getInstance().getIngestProfilePrefix(); private static final Logger logger = Logger.getLogger(IngestProfiles.class.getName()); /** @@ -83,10 +84,11 @@ public final class IngestProfiles { * @return The file location for the root settings of that profile. */ private static File getRootSettingsFile(String profileName) { - return new File( - SharedConfigPath.getInstance().getSettingsFilePath( - IngestJobSettings.getModuleSettingsResource( - getExecutionContext(getSanitizedProfile(profileName))))); + return Paths.get( + PlatformUtil.getUserConfigDirectory(), + IngestJobSettings.getModuleSettingsResource( + getExecutionContext(getSanitizedProfile(profileName))) + ".properties" + ).toFile(); } /** diff --git a/Core/src/org/sleuthkit/autopsy/ingest/profile/IngestProfilePaths.java b/Core/src/org/sleuthkit/autopsy/ingest/profile/IngestProfilePaths.java new file mode 100644 index 0000000000..5e39baa192 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/profile/IngestProfilePaths.java @@ -0,0 +1,48 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2022 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.ingest.profile; + +/** + * Path information for ingest profiles. + */ +public class IngestProfilePaths { + + private static final IngestProfilePaths instance = new IngestProfilePaths(); + + private static final String INGEST_PROFILE_PREFIX = "IngestProfiles."; + + private IngestProfilePaths() { + } + + /** + * @return An instance of this class. + */ + public static IngestProfilePaths getInstance() { + return instance; + } + + /** + * @return The prefix in front of all ingest profiles to differentiate + * between this and other ingest settings (i.e. command line, add + * image ingest wizard, etc.). + */ + public String getIngestProfilePrefix() { + return INGEST_PROFILE_PREFIX; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/infrastructure/HashConfigPaths.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/infrastructure/HashConfigPaths.java index 0e864b9fe6..3e76efe062 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/infrastructure/HashConfigPaths.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/infrastructure/HashConfigPaths.java @@ -19,7 +19,7 @@ package org.sleuthkit.autopsy.modules.hashdatabase.infrastructure; import java.nio.file.Paths; -import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; +import org.sleuthkit.autopsy.coreutils.PlatformUtil; /** * Paths for hash config files. @@ -31,7 +31,7 @@ public class HashConfigPaths { private static final String HASHSET_FOLDER = "HashLookup"; private static final String SERIALIZATION_FILE_NAME = "hashLookup.settings"; //NON-NLS - private static final String HASH_CONFIG_PATH = Paths.get(SharedConfigPath.getInstance().getSharedConfigPath(), HASHSET_FOLDER).toAbsolutePath().toString(); + private static final String HASH_CONFIG_PATH = Paths.get(PlatformUtil.getModuleConfigDirectory(), HASHSET_FOLDER).toAbsolutePath().toString(); private static final String XML_FILE_NAME = "hashsets.xml"; //NON-NLS private static final String XML_FILE_PATH = Paths.get(HASH_CONFIG_PATH, XML_FILE_NAME).toAbsolutePath().toString(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index a5e7f8a25c..73d8f1946c 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -30,7 +30,6 @@ import java.util.Map; import java.util.Observable; import org.apache.commons.io.FileUtils; import org.openide.util.NbBundle; -import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition; @@ -51,7 +50,7 @@ public final class FilesSetsManager extends Observable { private static final String INTERESTING_FILES_SET_DEFS_NAME = "InterestingFileSets.settings"; private static final String FILE_INGEST_FILTER_DEFS_NAME = "FileIngestFilterDefs.settings"; private static final String LEGACY_SETTINGS_PATH = PlatformUtil.getUserConfigDirectory(); - private static final String SETTINGS_PATH = SharedConfigPath.getInstance().getSharedConfigPath(); + private static final String SETTINGS_PATH = PlatformUtil.getModuleConfigDirectory(); private static final String FILE_FILTER_PATH = Paths.get(SETTINGS_PATH, FILE_INGEST_FILTER_DEFS_NAME).toAbsolutePath().toString(); private static final String INTERESTING_ITEM_PATH = Paths.get(SETTINGS_PATH, INTERESTING_FILES_SET_DEFS_NAME).toAbsolutePath().toString(); private static final Object FILE_INGEST_FILTER_LOCK = new Object(); @@ -138,7 +137,7 @@ public final class FilesSetsManager extends Observable { */ public Map getCustomFileIngestFilters() throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { - return FileSetsDefinitions.readSerializedDefinitions(SharedConfigPath.getInstance().getSharedConfigPath(), FILE_INGEST_FILTER_DEFS_NAME); + return FileSetsDefinitions.readSerializedDefinitions(PlatformUtil.getModuleConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME); } } @@ -161,7 +160,7 @@ public final class FilesSetsManager extends Observable { */ void setCustomFileIngestFilters(Map filesSets) throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { - FileSetsDefinitions.writeDefinitionsFile(SharedConfigPath.getInstance().getSharedConfigPath(), FILE_INGEST_FILTER_DEFS_NAME, filesSets); + FileSetsDefinitions.writeDefinitionsFile(PlatformUtil.getModuleConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME, filesSets); } } @@ -173,7 +172,7 @@ public final class FilesSetsManager extends Observable { */ public Map getInterestingFilesSets() throws FilesSetsManagerException { synchronized (INTERESTING_FILES_SET_LOCK) { - return InterestingItemsFilesSetSettings.readDefinitionsFile(SharedConfigPath.getInstance().getSharedConfigPath(), INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME); + return InterestingItemsFilesSetSettings.readDefinitionsFile(PlatformUtil.getModuleConfigDirectory(), INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME); } } @@ -186,7 +185,7 @@ public final class FilesSetsManager extends Observable { */ void setInterestingFilesSets(Map filesSets) throws FilesSetsManagerException { synchronized (INTERESTING_FILES_SET_LOCK) { - InterestingItemsFilesSetSettings.writeDefinitionsFile(SharedConfigPath.getInstance().getSharedConfigPath(), INTERESTING_FILES_SET_DEFS_NAME, filesSets); + InterestingItemsFilesSetSettings.writeDefinitionsFile(PlatformUtil.getModuleConfigDirectory(), INTERESTING_FILES_SET_DEFS_NAME, filesSets); this.setChanged(); this.notifyObservers(); } diff --git a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java index 32ca7a6a2b..9c7328aff6 100755 --- a/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java +++ b/Core/src/org/sleuthkit/autopsy/report/infrastructure/ReportingConfigLoader.java @@ -37,7 +37,6 @@ import java.util.logging.Level; import org.apache.commons.io.FileUtils; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; -import org.sleuthkit.autopsy.core.configpath.SharedConfigPath; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.report.GeneralReportSettings; @@ -58,7 +57,7 @@ final class ReportingConfigLoader { ).toAbsolutePath().toString(); private static final String REPORT_CONFIG_FOLDER_PATH = Paths.get( - SharedConfigPath.getInstance().getSharedConfigPath(), + PlatformUtil.getModuleConfigDirectory(), ReportingConfigLoader.REPORT_CONFIG_FOLDER ).toAbsolutePath().toString(); diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java index 503a6428d4..970303c62e 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java @@ -87,7 +87,7 @@ public class SharedConfiguration { private static final String UPLOAD_IN_PROGRESS_FILE = "uploadInProgress"; // NON-NLS private static final String moduleDirPath = PlatformUtil.getUserConfigDirectory(); - private static final String SHARED_DIR_PATH = Paths.get(moduleDirPath, "SharableConfig").toAbsolutePath().toString(); + private static final String SHARED_DIR_PATH = PlatformUtil.getModuleConfigDirectory(); private static final String INGEST_MODULES_PATH = Paths.get(SHARED_DIR_PATH, "IngestSettings").toString(); private static final String INGEST_MODULES_REL_PATH = new File(moduleDirPath).toURI().relativize(new File(INGEST_MODULES_PATH).toURI()).getPath(); private static final Logger logger = Logger.getLogger(SharedConfiguration.class.getName());