nsMPFileLocProvider *locProvider;      locProvider = new nsMPFileLocProvider; rv = locProvider->Initialize(profileDir, sProfileName); }
nsCOMPtr<nsProfileDirServiceProvider> locProvider; NS_NewProfileDirServiceProvider(PR_TRUE, getter_AddRefs(locProvider)); if (!locProvider) return NS_ERROR_FAILURE;     rv = locProvider->Register(); if (NS_FAILED(rv)) return rv; rv = locProvider->SetProfileDir(profileDir); if (NS_FAILED(rv)) return rv; }
StartupProfile(char *sProfileDir, char *sProfileName){  	// initialize profiles  	if (sProfileDir && sProfileName) 	{		nsresult rv;		nsCOMPtr<nsILocalFile> profileDir;		PRBool exists = PR_FALSE;		PRBool isDir = PR_FALSE;		profileDir = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);		rv = profileDir->InitWithNativePath(nsDependentCString(sProfileDir));		if (NS_FAILED(rv))		  	return NS_ERROR_FAILURE;		profileDir->Exists(&exists);		profileDir->IsDirectory(&isDir);		// if it exists and it isn't a directory then give up now.		if (!exists) 		{		  	rv = profileDir->Create(nsIFile::DIRECTORY_TYPE, 0700);		  	if NS_FAILED(rv)				return NS_ERROR_FAILURE;		}		else if (exists && !isDir)		  	return NS_ERROR_FAILURE;		// actually create the loc provider and initialize prefs.		nsMPFileLocProvider *locProvider;		// Set up the loc provider.  This has a really strange ownership		// model.  When I initialize it it will register itself with the		// directory service.  The directory service becomes the owning		// reference.  So, when that service is shut down this object will		// be destroyed.  It's not leaking here.		locProvider = new nsMPFileLocProvider;		rv = locProvider->Initialize(profileDir, sProfileName);  	}  	return NS_OK;}