* use NIO.2 to create directory structure (and hopefully get more meaningful IO exceptions)

This commit is contained in:
Reinhard Pointner 2015-03-23 08:22:06 +00:00
parent 3115efca0a
commit a04e263c30
1 changed files with 3 additions and 5 deletions

View File

@ -102,12 +102,10 @@ public final class FileUtilities {
destination = new File(source.getParentFile(), destination.getPath());
}
// make sure we that we can create the destination folder structure
File destinationFolder = destination.getParentFile();
// create parent folder if necessary
if (mkdirs && !destinationFolder.isDirectory() && !destinationFolder.mkdirs()) {
throw new IOException("Failed to create folder: " + destinationFolder);
if (mkdirs) {
// make sure that the folder structure is created, and throw exception if the folder structure can't be created
Files.createDirectories(destination.getParentFile().toPath());
}
return destination;