Fix for #130877 - Chnages to create app specific component registries

r=dougt, sr=shaver, a=drivers
This commit is contained in:
chak%netscape.com 2002-06-11 20:38:01 +00:00
Родитель e42bf70459
Коммит 9398afc66a
5 изменённых файлов: 38 добавлений и 13 удалений

Просмотреть файл

@ -3069,18 +3069,6 @@ nsComponentManagerImpl::AutoRegisterImpl(PRInt32 when,
{
// Use supplied components' directory
dir = inDirSpec;
if (fileIsCompDir) {
// Set components' directory for AutoRegisterInterfces to query
nsCOMPtr<nsIProperties> directoryService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
// Don't care if undefining fails
directoryService->Undefine(NS_XPCOM_COMPONENT_DIR);
rv = directoryService->Define(NS_XPCOM_COMPONENT_DIR, dir);
if (NS_FAILED(rv)) return rv;
}
}
else
{

Просмотреть файл

@ -338,6 +338,8 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile)
nsIAtom* nsDirectoryService::sCurrentProcess = nsnull;
nsIAtom* nsDirectoryService::sComponentRegistry = nsnull;
nsIAtom* nsDirectoryService::sComponentDirectory = nsnull;
nsIAtom* nsDirectoryService::sMRE_Directory = nsnull;
nsIAtom* nsDirectoryService::sMRE_ComponentDirectory = nsnull;
nsIAtom* nsDirectoryService::sOS_DriveDirectory = nsnull;
nsIAtom* nsDirectoryService::sOS_TemporaryDirectory = nsnull;
nsIAtom* nsDirectoryService::sOS_CurrentProcessDirectory = nsnull;
@ -437,7 +439,9 @@ nsDirectoryService::Init()
nsDirectoryService::sCurrentProcess = NS_NewAtom(NS_XPCOM_CURRENT_PROCESS_DIR);
nsDirectoryService::sComponentRegistry = NS_NewAtom(NS_XPCOM_COMPONENT_REGISTRY_FILE);
nsDirectoryService::sComponentDirectory = NS_NewAtom(NS_XPCOM_COMPONENT_DIR);
nsDirectoryService::sMRE_Directory = NS_NewAtom(NS_MRE_DIR);
nsDirectoryService::sMRE_ComponentDirectory = NS_NewAtom(NS_MRE_COMPONENT_DIR);
nsDirectoryService::sOS_DriveDirectory = NS_NewAtom(NS_OS_DRIVE_DIR);
nsDirectoryService::sOS_TemporaryDirectory = NS_NewAtom(NS_OS_TEMP_DIR);
nsDirectoryService::sOS_CurrentProcessDirectory = NS_NewAtom(NS_OS_CURRENT_PROCESS_DIR);
@ -527,6 +531,8 @@ nsDirectoryService::~nsDirectoryService()
NS_IF_RELEASE(nsDirectoryService::sCurrentProcess);
NS_IF_RELEASE(nsDirectoryService::sComponentRegistry);
NS_IF_RELEASE(nsDirectoryService::sComponentDirectory);
NS_IF_RELEASE(nsDirectoryService::sMRE_Directory);
NS_IF_RELEASE(nsDirectoryService::sMRE_ComponentDirectory);
NS_IF_RELEASE(nsDirectoryService::sOS_DriveDirectory);
NS_IF_RELEASE(nsDirectoryService::sOS_TemporaryDirectory);
NS_IF_RELEASE(nsDirectoryService::sOS_CurrentProcessDirectory);
@ -807,6 +813,16 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret
if (localFile)
localFile->AppendNative(COMPONENT_REGISTRY_NAME);
}
else if (inAtom == nsDirectoryService::sMRE_Directory)
{
rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));
}
else if (inAtom == nsDirectoryService::sMRE_ComponentDirectory)
{
rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));
if (localFile)
localFile->AppendNative(COMPONENT_DIRECTORY);
}
else if (inAtom == nsDirectoryService::sComponentDirectory)
{
rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));

Просмотреть файл

@ -82,6 +82,8 @@ private:
static nsIAtom *sCurrentProcess;
static nsIAtom *sComponentRegistry;
static nsIAtom *sComponentDirectory;
static nsIAtom *sMRE_Directory;
static nsIAtom *sMRE_ComponentDirectory;
static nsIAtom *sOS_DriveDirectory;
static nsIAtom *sOS_TemporaryDirectory;
static nsIAtom *sOS_CurrentProcessDirectory;

Просмотреть файл

@ -59,6 +59,9 @@
#define NS_XPCOM_COMPONENT_REGISTRY_FILE "ComRegF"
#define NS_XPCOM_COMPONENT_DIR "ComsD"
#define NS_MRE_DIR "MreD"
#define NS_MRE_COMPONENT_DIR "MreComsD"
#define NS_OS_HOME_DIR "Home"
#define NS_OS_DRIVE_DIR "DrvD"
#define NS_OS_TEMP_DIR "TmpD"

Просмотреть файл

@ -250,6 +250,22 @@ PRBool xptiInterfaceInfoManager::BuildFileSearchPath(nsISupportsArray** aPath)
// Add additional plugins dirs
// No error checking here since this is optional in some embeddings
// Add the MRE's component directory to searchPath if the
// application is using an MRE.
// An application indicates that it's using an MRE by returning
// a valid nsIFile via it's directory service provider interface.
//
// Please see http://www.mozilla.org/projects/embedding/MRE.html
// for more info. on MREs
//
nsCOMPtr<nsILocalFile> mreComponentDirectory;
nsresult rv = GetDirectoryFromDirService(NS_MRE_COMPONENT_DIR,
getter_AddRefs(mreComponentDirectory));
if (NS_SUCCEEDED(rv))
{
searchPath->AppendElement(mreComponentDirectory);
}
(void) AppendFromDirServiceList(NS_APP_PLUGINS_DIR_LIST, searchPath);