diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java index dd51fc15ba7cde1deac7bf5e8f5fc0dbf1ac159a..b132a8541e0415612d7192160f109202786961a8 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java @@ -432,7 +432,7 @@ private void saveAsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN- File hashDbFolder = new File(path.toString()); // create the folder if it doesn't exist if (!hashDbFolder.exists()) { - hashDbFolder.mkdir(); + hashDbFolder.mkdirs(); } if (!hashSetNameTextField.getText().isEmpty()) { path.append(File.separator).append(hashSetNameTextField.getText()); diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java index b6838f3adf7eca8680e448d8d59b3a75a5e5e8a9..c9b4602dcf7ec27cb896e8c93bb1bc3c5d59a6e3 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java @@ -430,7 +430,7 @@ private void openButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI File hashDbFolder = new File(lastBaseDirectory); // create the folder if it doesn't exist if (!hashDbFolder.exists()) { - hashDbFolder.mkdir(); + hashDbFolder.mkdirs(); } fileChooser.setCurrentDirectory(hashDbFolder); if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { @@ -534,7 +534,9 @@ private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS // copy the hash database to user configuration directory and use that path instead (JIRA-4177) String locationInUserConfigDir = Paths.get(HashLookupSettings.getBaseHashsetConfigPath(), HashDbCreateDatabaseDialog.HASH_DATABASE_DIR_NAME, hashSetNameTextField.getText(), file.getName()).toString(); try { - FileUtils.copyFile(file, new File(locationInUserConfigDir)); + File newFileLoc = new File(locationInUserConfigDir); + newFileLoc.getParentFile().mkdirs(); + FileUtils.copyFile(file, newFileLoc); // update the hash database location selectedFilePath = locationInUserConfigDir; } catch (IOException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java index bca8a2d750cfe756cbe361487203b21199775c44..e2f353fee1e0f93245247a4718eddeff71792653 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java @@ -61,7 +61,7 @@ Map<String, FilesSet> getFilesSets() { */ static boolean writeDefinitionsFile(String basePath, String fileName, Map<String, FilesSet> interestingFilesSets) throws FilesSetsManager.FilesSetsManagerException { File outputPath = Paths.get(basePath, fileName).toFile(); - outputPath.mkdirs(); + outputPath.getParentFile().mkdirs(); try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(outputPath))) { out.writeObject(new FileSetsDefinitions(interestingFilesSets)); } catch (IOException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java index 376f1d5693b61dec4daf9f09d6817634d7a1c5af..e1655001321d413875aeb49c101ef64c71497eea 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java @@ -608,7 +608,7 @@ static Map<String, FilesSet> readDefinitionsXML(Document doc, String resourceNam */ static boolean writeDefinitionsFile(String basePath, String fileName, Map<String, FilesSet> interestingFilesSets) throws FilesSetsManager.FilesSetsManagerException { File outputFile = Paths.get(basePath, fileName).toFile(); - outputFile.mkdirs(); + outputFile.getParentFile().mkdirs(); try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(outputFile))) { out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); } catch (IOException ex) {