From a0d9972be03c3c54e250e9b18a61279a3411b342 Mon Sep 17 00:00:00 2001 From: "locka%iol.ie" Date: Wed, 21 Jun 2000 13:19:12 +0000 Subject: [PATCH] NOT PART OF BUILD. Created variant of NS_InitEmbedding that accepts an nsILocalFile object as a parameter git-svn-id: svn://10.0.0.236/trunk@72764 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/embedding/base/nsEmbedAPI.cpp | 31 +++++++++++++++++---------- mozilla/embedding/base/nsEmbedAPI.h | 3 +++ 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/mozilla/embedding/base/nsEmbedAPI.cpp b/mozilla/embedding/base/nsEmbedAPI.cpp index 47f23f363ed..34c99628888 100644 --- a/mozilla/embedding/base/nsEmbedAPI.cpp +++ b/mozilla/embedding/base/nsEmbedAPI.cpp @@ -23,7 +23,6 @@ */ #include "nsIServiceManager.h" -#include "nsILocalFile.h" #include "nsIEventQueueService.h" #include "nsIStringBundle.h" @@ -68,7 +67,24 @@ extern "C" void NS_SetupRegistry(); static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); + nsresult NS_InitEmbedding(const char *aPath) +{ + // Create an object to represent the path + nsILocalFile *localFile = nsnull; + if (aPath && strlen(aPath) > 0) + { + NS_NewLocalFile(aPath, &localFile); + } + + nsresult rv = NS_InitEmbedding(localFile); + NS_IF_RELEASE(localFile); + + return rv; +} + + +nsresult NS_InitEmbedding(nsILocalFile *aPath) { // Reentrant calls to this method do nothing except increment a counter if (++sInitCounter > 1) @@ -82,18 +98,10 @@ nsresult NS_InitEmbedding(const char *aPath) if (!sXPCOMInitializedFlag) #endif { - // Create an object to represent the path - nsILocalFile *pBinDirPath = nsnull; - if (aPath && strlen(aPath) > 0) - { - NS_NewLocalFile(aPath, &pBinDirPath); - } - // Initialise XPCOM - if (pBinDirPath) + if (aPath) { - NS_InitXPCOM(&sServiceManager, pBinDirPath); - NS_RELEASE(pBinDirPath); + NS_InitXPCOM(&sServiceManager, aPath); } else { @@ -155,6 +163,7 @@ nsresult NS_InitEmbedding(const char *aPath) return NS_OK; } + nsresult NS_TermEmbedding() { // Reentrant calls to this method do nothing except decrement a counter diff --git a/mozilla/embedding/base/nsEmbedAPI.h b/mozilla/embedding/base/nsEmbedAPI.h index 97dfdb500e1..89c34e40c11 100644 --- a/mozilla/embedding/base/nsEmbedAPI.h +++ b/mozilla/embedding/base/nsEmbedAPI.h @@ -25,7 +25,10 @@ #ifndef NSEMBEDAPI_H #define NSEMBEDAPI_H +#include "nsILocalFile.h" + extern nsresult NS_InitEmbedding(const char *aPath); +extern nsresult NS_InitEmbedding(nsILocalFile *aPath); extern nsresult NS_TermEmbedding(); #endif \ No newline at end of file