19 package com.basistech.df.cybertriage.autopsy.incidentoptions;
21 import java.io.IOException;
22 import java.nio.file.Files;
23 import java.nio.file.Path;
24 import java.nio.file.Paths;
25 import java.util.Objects;
26 import java.util.logging.Level;
28 import org.apache.commons.lang3.StringUtils;
29 import org.openide.modules.Places;
46 if (Objects.nonNull(Places.getUserDirectory()) && Places.getUserDirectory().getAbsolutePath().endsWith(
"testuserdir")) {
47 LOGGER.log(Level.INFO,
"Application Data (test mode) Path: " + Places.getUserDirectory().getAbsolutePath());
48 return Places.getUserDirectory().getAbsolutePath();
52 String localDataStr = System.getenv(
"LOCALAPPDATA");
53 if (StringUtils.isNotBlank(localDataStr)) {
54 Path localAppPath = Paths.get(localDataStr, CYBERTRIAGE_FOLDER);
56 Files.createDirectories(localAppPath);
57 LOGGER.log(Level.INFO,
"Application Data Path: " + localAppPath.toString());
58 return localAppPath.toString();
59 }
catch (IOException ex) {
60 LOGGER.log(Level.SEVERE,
"IO Error using " + localAppPath.toString(), ex);
66 String homePathStr = System.getenv(
"HOME");
67 if (StringUtils.isNotBlank(homePathStr)) {
68 Path localAppPath = Paths.get(homePathStr, CYBERTRIAGE_DOT_FOLDER);
70 Files.createDirectories(localAppPath);
71 LOGGER.log(Level.INFO,
"Non-windows Application Data Path: " + localAppPath.toString());
72 return localAppPath.toString();
73 }
catch (IOException ex) {
74 LOGGER.log(Level.SEVERE,
"IO Error using " + localAppPath.toString(), ex);
80 return Places.getUserDirectory().getAbsolutePath();
static String getDefaultFileRepoPath()
static final String DEFAULT_FILE_REPO_PATH
static final String CYBERTRIAGE_FOLDER
static final String CYBERTRIAGE_DOT_FOLDER
CTSettings setFileRepoPath(String fileRepoPath)
synchronized static Logger getLogger(String name)
static String getAppDataLocalDirectory()
static final Logger LOGGER