Plugins now can properly load support dlls that are located in the

plugin directory.
This commit is contained in:
amusil%netscape.com 1999-04-23 23:43:54 +00:00
parent f9cb7e23a9
commit 97e47c5527
2 changed files with 52 additions and 2 deletions

View File

@ -234,9 +234,34 @@ nsPluginFile::~nsPluginFile()
nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
{
// How can we convert to a full path names for using with NSPR?
//nsFilePath path(*this);
const char* path = this->GetCString();
char* index;
char* pluginFolderPath = PL_strdup(path);
index = PL_strrchr(pluginFolderPath, '\\');
*index = 0;
BOOL restoreOrigDir = FALSE;
char aOrigDir[MAX_PATH + 1];
DWORD dwCheck = ::GetCurrentDirectory(sizeof(aOrigDir), aOrigDir);
NS_ASSERTION(dwCheck <= MAX_PATH + 1, "Error in Loading plugin");
if (dwCheck <= MAX_PATH + 1)
{
restoreOrigDir = ::SetCurrentDirectory(pluginFolderPath);
NS_ASSERTION(restoreOrigDir, "Error in Loading plugin");
}
outLibrary = PR_LoadLibrary(path);
if (restoreOrigDir)
{
BOOL bCheck = ::SetCurrentDirectory(aOrigDir);
NS_ASSERTION(bCheck, "Error in Loading plugin");
}
PL_strfree(pluginFolderPath);
return NS_OK;
}

View File

@ -234,9 +234,34 @@ nsPluginFile::~nsPluginFile()
nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
{
// How can we convert to a full path names for using with NSPR?
//nsFilePath path(*this);
const char* path = this->GetCString();
char* index;
char* pluginFolderPath = PL_strdup(path);
index = PL_strrchr(pluginFolderPath, '\\');
*index = 0;
BOOL restoreOrigDir = FALSE;
char aOrigDir[MAX_PATH + 1];
DWORD dwCheck = ::GetCurrentDirectory(sizeof(aOrigDir), aOrigDir);
NS_ASSERTION(dwCheck <= MAX_PATH + 1, "Error in Loading plugin");
if (dwCheck <= MAX_PATH + 1)
{
restoreOrigDir = ::SetCurrentDirectory(pluginFolderPath);
NS_ASSERTION(restoreOrigDir, "Error in Loading plugin");
}
outLibrary = PR_LoadLibrary(path);
if (restoreOrigDir)
{
BOOL bCheck = ::SetCurrentDirectory(aOrigDir);
NS_ASSERTION(bCheck, "Error in Loading plugin");
}
PL_strfree(pluginFolderPath);
return NS_OK;
}