1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 16:28:51 -05:00

* 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

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;