Exemplo n.º 1
0
 /**
  * This function will create any missing folders in a file path if they do not exits. For example,
  * if you are saving C:\stuff\test.txt and stuff does not exist, this will create it.
  *
  * @param file The file to make the directories for.
  * @throws IOException Exception if subdirectory creation failed.
  */
 public static void mkdirForFile(File file) throws IOException {
   if (file.getParentFile().exists()) {
     return;
   } else {
     mkdirForFile(file.getParentFile());
     if (true == file.getParentFile().mkdir()) {
       return;
     } else {
       throw (new IOException("Subdirectory creation failed: " + file.getParentFile()));
     }
   }
 } /* CommonInstrumentationTest */