Files.createDirectories may throw java.nio.file.FileAlreadyExistsException in certain cases (conflict with docs)

@see https://github.com/filebot/filebot/issues/40#issuecomment-338475728
This commit is contained in:
Reinhard Pointner 2017-10-28 22:05:50 +02:00
parent 3a3ccba37e
commit a3085de6fc

View File

@ -114,7 +114,10 @@ public final class FileUtilities {
destination = resolve(source, destination);
// create parent folder if necessary and make sure that the folder structure is created, and throw exception if the folder structure can't be created
Files.createDirectories(destination.getParentFile().toPath());
Path parentFolder = destination.toPath().getParent();
if (Files.notExists(parentFolder)) {
Files.createDirectories(parentFolder);
}
return destination;
}