diff --git a/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java b/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java index 80699487ed..2f1c6a5ae5 100755 --- a/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java +++ b/Core/src/org/sleuthkit/autopsy/core/UserPreferences.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.core; +import java.util.prefs.BackingStoreException; import org.sleuthkit.autopsy.events.MessageServiceConnectionInfo; import java.util.prefs.PreferenceChangeListener; import java.util.prefs.Preferences; @@ -58,6 +59,27 @@ public final class UserPreferences { private UserPreferences() { } + /** + * Reload all preferences from disk. This is only needed if the preferences + * file is being directly modified on disk while Autopsy is running. + * + * @throws BackingStoreException + */ + public static void reloadFromStorage() throws BackingStoreException { + preferences.sync(); + } + + /** + * Saves the current preferences to storage. This is only needed if the + * preferences files are going to be copied to another location while + * Autopsy is running. + * + * @throws BackingStoreException + */ + public static void saveToStorage() throws BackingStoreException { + preferences.flush(); + } + public static void addChangeListener(PreferenceChangeListener listener) { preferences.addPreferenceChangeListener(listener); }