char *basename = uri.ToNewCString(); if (!basename)	continue; basename = nsUnescape(basename); if (!basename)	continue;
char *baseFilename = uri.ToNewCString(); if (!baseFilename)	continue; baseFilename = nsUnescape(baseFilename); if (!baseFilename)	continue;
SearchDataSource::GetSearchEngineList(){        nsresult			rv = NS_OK;	if (!mInner)	{		return(NS_RDF_NO_VALUE);	}#ifdef	XP_MAC	// on Mac, use system's search files	nsSpecialSystemDirectory	searchSitesDir(nsSpecialSystemDirectory::Mac_InternetSearchDirectory);	nsFileSpec 			nativeDir(searchSitesDir);#else	// on other platforms, use our search files	nsSpecialSystemDirectory	searchSitesDir(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);	// XXX we should get this from prefs?	searchSitesDir += "res";	searchSitesDir += "rdf";	searchSitesDir += "search";	nsFileSpec 			nativeDir(searchSitesDir);#endif	for (nsDirectoryIterator i(nativeDir); i.Exists(); i++)	{		const nsFileSpec	fileSpec = (const nsFileSpec &)i;		const char		*childURL = fileSpec;		if (!isVisible(fileSpec))	continue;		if (childURL != nsnull)		{			nsAutoString	uri(childURL);			PRInt32		len = uri.Length();			if (len > 4)			{#ifdef	XP_MAC				// be sure to resolve aliases in case we encounter one				CInfoPBRec	cInfo;				OSErr		err;				PRBool		wasAliased = PR_FALSE;				fileSpec.ResolveAlias(wasAliased);				err = fileSpec.GetCatInfo(cInfo);				if ((!err) && (cInfo.hFileInfo.ioFlFndrInfo.fdType == 'issp') &&					(cInfo.hFileInfo.ioFlFndrInfo.fdCreator == 'fndf'))#else				nsAutoString	extension;				if ((uri.Right(extension, 4) == 4) && (extension.EqualsIgnoreCase(".src")))#endif				{#ifdef	XP_MAC					PRInt32	separatorOffset = uri.RFind(":");#else					PRInt32	separatorOffset = uri.RFind("/");#endif					if (separatorOffset > 0)					{						uri.Cut(0, separatorOffset+1);												nsAutoString	searchURL(kEngineProtocol);						searchURL += uri;						char *basename = uri.ToNewCString();						if (!basename)	continue;						basename = nsUnescape(basename);						if (!basename)	continue;						nsAutoString	data("");						rv = ReadFileContents(basename, data);						delete [] basename;						basename = nsnull;						if (NS_FAILED(rv))	continue;						nsCOMPtr<nsIRDFResource>	searchRes;						char		*searchURI = searchURL.ToNewCString();						if (searchURI)						{							if (NS_SUCCEEDED(rv = gRDFService->GetResource(searchURI, getter_AddRefs(searchRes))))							{								mInner->Assert(kNC_SearchRoot, kNC_Child, searchRes, PR_TRUE);								// save name of search engine (as specified in file)								nsAutoString	nameValue;								if (NS_SUCCEEDED(rv = GetData(data, "search", "name", nameValue)))								{									nsCOMPtr<nsIRDFLiteral>	nameLiteral;									if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(nameValue.GetUnicode(), getter_AddRefs(nameLiteral))))									{										mInner->Assert(searchRes, kNC_Name, nameLiteral, PR_TRUE);									}								}							}							delete [] searchURI;							searchURI = nsnull;						}						delete [] basename;						basename = nsnull;					}				}			}		}	}	return(rv);}