docs: public static File ensureDir(File tgtDir) throws Exception {
      if (tgtDir.exists()) {
        if (tgtDir.isDirectory()) return tgtDir;
        else
          throw new Exception("Could not create directory "+tgtDir.getAbsolutePath()+", as a file already exists at that path.");
      } else {
        tgtDir.mkdirs();
        return tgtDir;
      }
    }