output_dir = new nsLocalFile(); rv = output_dir->InitWithNativePath(nsDependentCString(argv[++i]));
rv = NS_NewNativeLocalFile(nsDependentCString(argv[++i]), PR_TRUE, getter_AddRefs(output_dir));
int main(int argc, char** argv){  nsresult rv = NS_OK;  nsCOMPtr<nsILocalFile> output_dir;  // handle command line arguments  for (int i = 1; i < argc; i++) {    if (argv[i][0] != '-') {      rv = NS_ERROR_FAILURE;      break;    }    switch (argv[i][1]) {      case 'd': {        if (i + 1 == argc) {          fprintf(stderr, "ERROR: missing output directory after -d\n");          rv = NS_ERROR_FAILURE;          break;        }        // see if given path exists        output_dir = new nsLocalFile();        rv = output_dir->InitWithNativePath(nsDependentCString(argv[++i]));        PRBool val;        if (NS_FAILED(rv) || NS_FAILED(output_dir->Exists(&val)) || !val ||            NS_FAILED(output_dir->IsDirectory(&val)) || !val)        {          fprintf(stderr,                  "ERROR: output directory doesn't exist / isn't a directory\n");          rv = NS_ERROR_FAILURE;          break;        }        break;      }      default: {        fprintf(stderr, "ERROR: unknown option %s\n", argv[i]);        rv = NS_ERROR_FAILURE;        break;      }    }  }  if (NS_FAILED(rv)) {    PrintUsage(argv);    return 1;  }  rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);  NS_ENSURE_SUCCESS(rv, rv);  Generate gen(output_dir);  rv = gen.GenerateInterfaces();  NS_ShutdownXPCOM(nsnull);  return rv;}