Fix for bug 64501 - allow embedding apps to specify app registry location. Moves appfilelocprovider into xpcom.

r=dougt@netscape.com, sr=brendan@mozilla.org


git-svn-id: svn://10.0.0.236/trunk@85095 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ccarlen%netscape.com
2001-01-18 22:51:57 +00:00
parent 29032c436f
commit b807b06014
42 changed files with 162 additions and 399 deletions

View File

@@ -29,7 +29,6 @@
#include "nsIStringBundle.h"
#include "nsIDirectoryService.h"
#include "nsAppFileLocationProvider.h"
#include "nsEmbedAPI.h"
@@ -86,26 +85,10 @@ nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory,
#endif
{
// Initialise XPCOM
NS_InitXPCOM(&sServiceManager, mozBinDirectory);
NS_InitXPCOM2(&sServiceManager, mozBinDirectory, appFileLocProvider);
if (!sServiceManager)
return NS_ERROR_NULL_POINTER;
// Hook up the file location provider - make one if nsnull was passed
if (!appFileLocProvider)
{
appFileLocProvider = new nsAppFileLocationProvider;
if (!appFileLocProvider)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(appFileLocProvider);
}
NS_WITH_SERVICE(nsIDirectoryService, directoryService, NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
rv = directoryService->RegisterProvider(appFileLocProvider);
if (NS_FAILED(rv))
return rv;
NS_RELEASE(appFileLocProvider); // RegisterProvider did AddRef - It owns it now
#ifdef HACK_AROUND_NONREENTRANT_INITXPCOM
sXPCOMInitializedFlag = PR_TRUE;
sXPCOMCleanupHack.mCleanOnExit = PR_TRUE;