public static void ensureOutputDirectory(final File directory){
  if (!directory.exists()) {
    if (!directory.mkdirs()) {
      throw new NoTalkbackSlimException(ErrorType.DIRECTORY_NOT_CREATED,directory.getPath());
    }
  }
 else {
    if (!directory.isDirectory()) {
      throw new NoTalkbackSlimException(ErrorType.NOT_A_DIRECTORY,directory.getPath());
    }
  }
}

public static void ensureOutputDirectory ( final File directory ) { if ( ! directory . exists ( ) ) { if ( ! directory . mkdirs ( ) ) { throw new NoTalkbackSlimException ( ErrorType . DIRECTORY_NOT_CREATED , directory . getPath ( ) ) ; } } else { if ( ! directory . isDirectory ( ) ) { throw new NoTalkbackSlimException ( ErrorType . NOT_A_DIRECTORY , directory . getPath ( ) ) ; } } }
test if the supplied directory is valid for the purposes of writing a slim result . this means the directory either exists or does not exist and can be successfully created ( which this method will do ) .
