code: public static File createTemplateClassesDir(File tmpDir, String dirPath, 
                                                  Log log) {
          File destDir = null;
          if (dirPath != null && !dirPath.isEmpty()) {
              
              // handle file-based paths
              if (dirPath.startsWith("file:")) {
                  destDir = new File(dirPath.substring(5));
              }
              
              // otherwise, assume relative path to tmp dir
              else {
                  destDir = new File(tmpDir, dirPath);
                  try {
                      if (!destDir.getCanonicalPath().startsWith(
                              tmpDir.getCanonicalPath().concat(File.separator))) {
                          throw new IllegalStateException(
                              "invalid template classes directory: " + dirPath
                          );
                      }
                  }
                  catch (IOException ioe) {
                      throw new IllegalStateException(
                          "invalid template classes directory: " + dirPath, 
                          ioe
                      );
                  }
              }
  
              if (!destDir.isDirectory()) {
                  // try creating it but not the parents.
                  if (!destDir.mkdir()) {
                      log.warn("Could not create template classes directory: " +
                               destDir.getAbsolutePath());
                      destDir = null;
                  }
              }
  
              if (destDir != null && !destDir.canWrite()) {
                  log.warn("Unable to write to template classes directory: " +
                           destDir.getAbsolutePath());
                  destDir = null;
              }
          }
  
          return destDir;
      }
docs: converts a path to a File for storing compiled template classes.
  @return the directory or null if the directory is not there or
  if it cannot be written to.