19 package org.sleuthkit.autopsy.machinesettings;
22 import java.nio.file.Paths;
23 import java.util.Optional;
24 import java.util.prefs.Preferences;
25 import java.util.stream.Stream;
26 import org.apache.commons.lang3.StringUtils;
27 import org.openide.util.NbBundle;
28 import org.openide.util.NbPreferences;
68 static Optional<TempDirChoice>
getValue(String val) {
70 return Optional.empty();
74 .filter(tempChoice -> tempChoice.name().equalsIgnoreCase(val.trim()))
88 return preferences.get(CUSTOM_TEMP_DIR_KEY,
"");
105 "UserMachinePreferences_validateTempDirectory_errorOnCreate_text=There was an error creating the temp directory for path: {0}",
107 "UserMachinePreferences_validateTempDirectory_errorOnReadWrite_text=There was an error reading or writing to temp directory path: {0}"
110 if (StringUtils.isBlank(path)) {
115 File f =
new File(path);
116 if (!f.exists() && !f.mkdirs()) {
136 preferences.put(CUSTOM_TEMP_DIR_KEY, path);
146 .orElse(DEFAULT_CHOICE);
157 if (tempDirChoice == null) {
161 preferences.put(TEMP_DIR_CHOICE_KEY, tempDirChoice.name());
static Optional< TempDirChoice > getValue(String val)
static final Logger logger
static final Preferences preferences
static final String TEMP_DIR_CHOICE_KEY
static String getCustomTempDirectory()
static final String CUSTOM_TEMP_DIR_KEY
static boolean hasReadWriteAccess(Path dirPath)
static boolean validateTempDirectory(String path)
static final TempDirChoice DEFAULT_CHOICE
static void setCustomTempDirectory(String path)
static void setTempDirChoice(TempDirChoice tempDirChoice)
static TempDirChoice getTempDirChoice()
synchronized static Logger getLogger(String name)