Creates any necessary but nonexistent parent directories of the specified file. Note that if this operation fails it may have succeeded in creating some (but not all) of the necessary parent directories. @throws IOException if an I/O error occurs, or if any necessary but nonexistent parent dire
(File file)
| 472 | |
| 473 | |
| 474 | public static void createParentDirs(File file) throws IOException { |
| 475 | checkNotNull(file); |
| 476 | File parent = file.getCanonicalFile().getParentFile(); |
| 477 | if (parent == null) { |
| 478 | /* |
| 479 | * The given directory is a filesystem root. All zero of its ancestors exist. This doesn't |
| 480 | * mean that the root itself exists -- consider x:\ on a Windows machine without such a drive |
| 481 | * -- or even that the caller can create it, but this method makes no such guarantees even for |
| 482 | * non-root files. |
| 483 | */ |
| 484 | return; |
| 485 | } |
| 486 | parent.mkdirs(); |
| 487 | if (!parent.isDirectory()) { |
| 488 | throw new IOException("Unable to create parent directories of " + file); |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | /** |
| 493 | * Moves a file from one path to another. This method can rename a file and/or move it to a |
nothing calls this directly
no test coverage detected