NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR,
NS_GetSpecialDirectory(NS_GRE_DIR,
IsLoadableDTD(const nsCatalogData* aCatalogData, nsCOMPtr<nsIURI>* aDTD){  PRBool isLoadable = PR_FALSE;  nsresult res = NS_OK;  if (!aDTD || !*aDTD) {    NS_ASSERTION(0, "Null parameter.");    return PR_FALSE;  }  nsCAutoString fileName;  if (aCatalogData) {    // remap the DTD to a known local DTD    fileName.Assign(aCatalogData->mLocalDTD);  }  if (fileName.IsEmpty()) {    // try to see if the user has installed the DTD file -- we extract the    // filename.ext of the DTD here. Hence, for any DTD for which we have    // no predefined mapping, users just have to copy the DTD file to our    // special DTD directory and it will be picked    nsCOMPtr<nsIURL> dtdURL;    dtdURL = do_QueryInterface(*aDTD, &res);    if (NS_FAILED(res)) {      return PR_FALSE;    }    res = dtdURL->GetFileName(fileName);    if (NS_FAILED(res) || fileName.IsEmpty()) {      return PR_FALSE;    }  }    nsCOMPtr<nsIFile> dtdPath;  NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR,                          getter_AddRefs(dtdPath));  if (!dtdPath)    return PR_FALSE;  nsCOMPtr<nsILocalFile> lfile = do_QueryInterface(dtdPath);  // append res/dtd/<fileName>  // can't do AppendRelativeNativePath("res/dtd/" + fileName)  // as that won't work on all platforms.  lfile->AppendNative(NS_LITERAL_CSTRING("res"));  lfile->AppendNative(NS_LITERAL_CSTRING("dtd"));  lfile->AppendNative(fileName);  PRBool exists;  dtdPath->Exists(&exists);  if (exists) {    // The DTD was found in the local DTD directory.    // Set aDTD to a file: url pointing to the local DT    nsCOMPtr<nsIURI> dtdURI;    NS_NewFileURI(getter_AddRefs(dtdURI), dtdPath);     if (dtdURI) {      *aDTD = dtdURI;      isLoadable = PR_TRUE;    }  }  return isLoadable;}