putting back AutoReg by directory feature for wizard

This commit is contained in:
ssu%netscape.com 1999-08-11 02:50:52 +00:00
parent a72eebd885
commit 380428ac78

View File

@ -40,6 +40,10 @@
#include "plstr.h"
#ifdef XP_PC
#include <direct.h>
#endif
//------------------------------------------------------------------------
@ -75,7 +79,34 @@ PR_PUBLIC_API(nsresult) XPI_Init(
if (!NS_SUCCEEDED(rv))
return rv;
#ifdef XP_PC
//
// Passing 0 as the 2nd parameter to AutoRegister() will tell it to
// automatically determine the path to the components directory.
// Since XPI_Init() is being called by Setup.exe, not apprunner.exe,
// the wrong components directory is determined.
// As a requirement to loading xpistub.dll, it must be loaded from
// the same directory as xpcom.dll.
// This makes is easy to locate the correct components directory by
// using a form of GetCurrentDirectory().
//
// Since nsFileSpec() does not contain a GetCwd() function,
// a call to getcwd() is being used under Windows only.
//
char szTemp[_MAX_PATH];
getcwd(szTemp, _MAX_PATH);
PL_strcat(szTemp, "\\");
PL_strcat(szTemp, "components");
nsfsDirectory = szTemp;
rv = NS_NewFileSpecWithSpec(*(&nsfsDirectory), getter_AddRefs(nsIfsDirectory));
if(NS_FAILED(rv))
return rv;
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, nsIfsDirectory);
#else
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, 0);
#endif
if (NS_SUCCEEDED(rv))
{
rv = nsComponentManager::CreateInstance(kSoftwareUpdateCID,