/** * Gets the case directory path * * @return caseDirectoryPath */ public String getCaseDirectory() { if (xmlcm == null) { return ""; } else { return xmlcm.getCaseDirectory(); } }
/** * Opens the existing case (open the XML config file) * * @param configFilePath the path of the configuration file that's opened * @throws CaseActionException */ static void open(String configFilePath) throws CaseActionException { logger.log(Level.INFO, "Opening case.\nconfigFilePath: {0}", configFilePath); try { XMLCaseManagement xmlcm = new XMLCaseManagement(); xmlcm.open( configFilePath); // open and load the config file to the document handler in the XML class xmlcm.writeFile(); // write any changes to the config file String caseName = xmlcm.getCaseName(); String caseNumber = xmlcm.getCaseNumber(); String examiner = xmlcm.getCaseExaminer(); // if the caseName is "", case / config file can't be opened if (caseName.equals("")) { throw new CaseActionException("Case name is blank."); } String caseDir = xmlcm.getCaseDirectory(); String dbPath = caseDir + File.separator + "autopsy.db"; SleuthkitCase db = SleuthkitCase.openCase(dbPath); checkImagesExist(db); Case openedCase = new Case(caseName, caseNumber, examiner, configFilePath, xmlcm, db); changeCase(openedCase); } catch (Exception ex) { logger.log(Level.SEVERE, "Error opening the case: ", ex); // close the previous case if there's any CaseCloseAction closeCase = SystemAction.get(CaseCloseAction.class); closeCase.actionPerformed(null); if (!configFilePath.endsWith(CASE_DOT_EXTENSION)) { throw new CaseActionException( "Check that you selected the correct case file (usually with " + CASE_DOT_EXTENSION + " extension)", ex); } else { throw new CaseActionException("Error opening the case", ex); } } }