static NS_DEFINE_CID(kRDFXMLDataSourceCID, NS_RDFXMLDATASOURCE_CID); static NS_DEFINE_CID(kRDFServiceCID,       NS_RDFSERVICE_CID);  nsresult rv;    NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); if (NS_FAILED(rv)) return rv;  nsFileSpec spec; rv = profile->GetCurrentProfileDir(&spec); if (NS_FAILED(rv)) return rv;  spec += "localstore.rdf";  if (! spec.Exists()) { nsOutputFileStream	os(spec); os << "<?xml version=\"1.0\"?>" << nsEndl; os << "<RDF:RDF xmlns:RDF=\"" << RDF_NAMESPACE_URI << "\"" << nsEndl; os << "         xmlns:NC=\""  << NC_NAMESPACE_URI  << "\">" << nsEndl; os << "  <!-- Empty -->" << nsEndl; os << "</RDF:RDF>" << nsEndl; }  rv = nsComponentManager::CreateInstance(kRDFXMLDataSourceCID, nsnull, nsIRDFDataSource::GetIID(), (void**) &mInner); if (NS_FAILED(rv)) return rv;  nsCOMPtr<nsIRDFRemoteDataSource> remote = do_QueryInterface(mInner);  rv = remote->Init((const char*) nsFileURL(spec)); if (NS_FAILED(rv)) return rv;   NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv); if (NS_FAILED(rv)) return rv;  rv = rdf->RegisterDataSource(this, PR_FALSE); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register local store"); if (NS_FAILED(rv)) return rv;  return NS_OK;
return(NS_OK);
LocalStoreImpl::Init(){static NS_DEFINE_CID(kRDFXMLDataSourceCID, NS_RDFXMLDATASOURCE_CID);static NS_DEFINE_CID(kRDFServiceCID,       NS_RDFSERVICE_CID);    nsresult rv;	// Look for localstore.rdf in the current profile	// directory. Bomb if we can't find it.    NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv);    if (NS_FAILED(rv)) return rv;    nsFileSpec spec;    rv = profile->GetCurrentProfileDir(&spec);    if (NS_FAILED(rv)) return rv;    spec += "localstore.rdf";	if (! spec.Exists())	{		nsOutputFileStream	os(spec);		os << "<?xml version=\"1.0\"?>" << nsEndl;		os << "<RDF:RDF xmlns:RDF=\"" << RDF_NAMESPACE_URI << "\"" << nsEndl;		os << "         xmlns:NC=\""  << NC_NAMESPACE_URI  << "\">" << nsEndl;		os << "  <!-- Empty -->" << nsEndl;		os << "</RDF:RDF>" << nsEndl;	}    rv = nsComponentManager::CreateInstance(kRDFXMLDataSourceCID,                                            nsnull,                                            nsIRDFDataSource::GetIID(),                                            (void**) &mInner);    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIRDFRemoteDataSource> remote = do_QueryInterface(mInner);    rv = remote->Init((const char*) nsFileURL(spec));    if (NS_FAILED(rv)) return rv;    // register this as a named data source with the RDF service    NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);    if (NS_FAILED(rv)) return rv;    rv = rdf->RegisterDataSource(this, PR_FALSE);    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register local store");    if (NS_FAILED(rv)) return rv;    return NS_OK;}