public static void ensureFolderHierarchyExists(IFolder folder){
  if (!folder.exists()) {
    if (folder.getParent() instanceof IFolder) {
      ensureFolderHierarchyExists((IFolder)folder.getParent());
    }
    try {
      folder.create(true,true,null);
    }
 catch (    CoreException e) {
      String message=String.format("Cannot create folder %s.",folder);
      throw new GradlePluginsRuntimeException(message,e);
    }
  }
}

public static void ensureFolderHierarchyExists ( IFolder folder ) { if ( ! folder . exists ( ) ) { if ( folder . getParent ( ) instanceof IFolder ) { ensureFolderHierarchyExists ( ( IFolder ) folder . getParent ( ) ) ; } try { folder . create ( true , true , null ) ; } catch ( CoreException e ) { String message = String . format ( "Cannot create folder %s." , folder ) ; throw new GradlePluginsRuntimeException ( message , e ) ; } } }
ensures the given folder and its parent hierarchy are created if they do not already exist .
