From cb7218b7d7698a265a73109135697529a8854bc1 Mon Sep 17 00:00:00 2001 From: "jband%netscape.com" Date: Tue, 25 Apr 2000 05:01:05 +0000 Subject: [PATCH] Remove use of nsSpecialSystemDirectory. r=dougt --- .../xptinfo/src/xptiInterfaceInfoManager.cpp | 29 ++++++++++--------- xpcom/reflect/xptinfo/src/xptiprivate.h | 6 +++- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp index 611407e7e58e..a3e95452b6f5 100644 --- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp +++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp @@ -148,20 +148,23 @@ xptiInterfaceInfoManager::GetComponentsDir(nsILocalFile** aDir) { NS_ASSERTION(aDir,"loser!"); - // Make a new one each time because caller *will* modify it. + // We must make a new nsILocalFile each time because the caller *will* + // modify it. - nsCOMPtr dir = do_CreateInstance(NS_LOCAL_FILE_PROGID); - if(!dir) - return PR_FALSE; - - nsresult rv = dir->InitWithPath( - nsSpecialSystemDirectory( - nsSpecialSystemDirectory::XPCOM_CurrentProcessComponentDirectory)); - if(NS_FAILED(rv)) - return PR_FALSE; - - NS_ADDREF(*aDir = dir); - return PR_TRUE; + nsCOMPtr dirService = + do_GetService(NS_DIRECTORY_SERVICE_PROGID); + if(dirService) + { + nsCOMPtr dir; + dirService->Get("xpcom.currentProcess.componentDirectory", + NS_GET_IID(nsIFile), getter_AddRefs(dir)); + if(dir) + { + NS_ADDREF(*aDir = dir); + return PR_TRUE; + } + } + return PR_FALSE; } PRBool diff --git a/xpcom/reflect/xptinfo/src/xptiprivate.h b/xpcom/reflect/xptinfo/src/xptiprivate.h index 422c7a25b4f5..cfc7e4676abc 100644 --- a/xpcom/reflect/xptinfo/src/xptiprivate.h +++ b/xpcom/reflect/xptinfo/src/xptiprivate.h @@ -40,7 +40,10 @@ #include "nsIServiceManager.h" #include "nsIFile.h" #include "nsILocalFile.h" -#include "nsSpecialSystemDirectory.h" +#include "nsIDirectoryService.h" + +#include "nsCRT.h" +#include "nsIAllocator.h" #include "nsISupportsArray.h" #include "nsInt64.h" @@ -52,6 +55,7 @@ #include "nsAutoLock.h" +#include "plhash.h" #include "plstr.h" #include "prprf.h" #include "prio.h"