Introducing flags to specify plugins dir location.

Not used yet. Getting ready for 21938.
This commit is contained in:
av%netscape.com 2000-01-28 00:49:09 +00:00
Родитель 44c1cfd98b
Коммит 56f0cdee15
10 изменённых файлов: 84 добавлений и 84 удалений

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

@ -32,12 +32,18 @@
* scan the plugins directory. An nsPluginFileSpec can be constructed from the
* nsFileSpec returned by the iterator.
*/
/* Where to seek for plugins dir */
#define PLUGINS_DIR_LOCATION_AUTO 0
#define PLUGINS_DIR_LOCATION_MOZ_LOCAL 1
#define PLUGINS_DIR_LOCATION_4DOTX 2
class nsPluginsDir : public nsFileSpec {
public:
/**
* Locates the plugins directory in a platform-dependent manner.
*/
nsPluginsDir();
nsPluginsDir(PRUint16 location = PLUGINS_DIR_LOCATION_AUTO);
virtual ~nsPluginsDir();
/**

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

@ -51,7 +51,7 @@ static nsresult getApplicationSpec(FSSpec& outAppSpec)
return (result == noErr ? NS_OK : NS_ERROR_FAILURE);
}
nsPluginsDir::nsPluginsDir()
nsPluginsDir::nsPluginsDir(PRUint16 location)
{
#if 0
// Use the folder manager to get location of Extensions folder, and

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

@ -107,7 +107,7 @@ static char **BuildStringArray( char *aFlat, PRUint32 &aSize)
// nsPluginsDir class
nsPluginsDir::nsPluginsDir()
nsPluginsDir::nsPluginsDir(PRUint16 location)
{
// XXX This isn't right for the embedded case, but it's as close
// as we can do right now.

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

@ -69,7 +69,7 @@ static PRUint32 CalculateVariantCount(char* mimeTypes)
/* nsPluginsDir implementation */
nsPluginsDir::nsPluginsDir()
nsPluginsDir::nsPluginsDir(PRUint16 location)
{
// this is somewhat lacking, in that it doesn't fall back to any other directories.
// then again, I'm not sure we should be falling back at all. plugins have been (and probably

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

@ -119,45 +119,46 @@ static char** MakeStringArray(PRUint32 variants, char* data)
/* nsPluginsDir implementation */
nsPluginsDir::nsPluginsDir()
nsPluginsDir::nsPluginsDir(PRUint16 location)
{
HKEY keyloc;
DWORD pathlen, type;
long result;
DWORD pathlen;
char path[2000];
const char* allocPath;
//PRDir *dir = nsnull;
// first, let's look for a plugin folder that exists in the
// same directory as our executable
if (::GetModuleFileName(NULL, path, sizeof(path)) > 0)
{
pathlen = PL_strlen(path) - 1;
while (pathlen > 0)
if((location == PLUGINS_DIR_LOCATION_AUTO) || (location == PLUGINS_DIR_LOCATION_MOZ_LOCAL))
{
// look for a plugin folder that exists in the same directory as our executable
if (::GetModuleFileName(NULL, path, sizeof(path)) > 0)
{
if (path[pathlen] == '\\')
break;
pathlen = PL_strlen(path) - 1;
pathlen--;
}
while (pathlen > 0)
{
if (path[pathlen] == '\\')
break;
if (pathlen > 0)
{
PL_strcpy(&path[pathlen + 1], "plugins");
//dir = PR_OpenDir(path);
pathlen--;
}
allocPath = path;//PL_strdup(path);
*(nsFileSpec*)this = allocPath;
if (pathlen > 0)
{
PL_strcpy(&path[pathlen + 1], "plugins");
allocPath = path;
*(nsFileSpec*)this = allocPath;
}
}
}
}
if(((location == PLUGINS_DIR_LOCATION_AUTO) && !Exists()) ||
(location == PLUGINS_DIR_LOCATION_4DOTX))
{
// look for the plugin folder that the user has in their Communicator 4x install
HKEY keyloc;
long result;
DWORD type;
// if we didn't find it, let's look for the plugin folder
// that the user has in their Communicator 4x install
if(!Exists())
{
path[0] = 0;
//PL_strfree(allocPath);
result = ::RegOpenKeyEx(HKEY_CURRENT_USER,
"Software\\Netscape\\Netscape Navigator\\Main",
@ -178,10 +179,9 @@ nsPluginsDir::nsPluginsDir()
::RegCloseKey(keyloc);
}
//dir = PR_OpenDir(path);
allocPath = PL_strdup(path);
*(nsFileSpec*)this = allocPath;
}
}
#ifdef NS_DEBUG
if (path[0] != 0)
@ -285,12 +285,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
DWORD zerome, versionsize;
char* verbuf = nsnull;
const char* path = this->GetCString();
/*
const char* fileName;
fileName = PL_strrchr(path, '\\');
if(fileName)
++fileName;
*/
versionsize = ::GetFileVersionInfoSize((char*)path, &zerome);
if (versionsize > 0)
verbuf = (char *)PR_Malloc(versionsize);
@ -310,8 +305,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
info.fMimeTypeArray = MakeStringArray(info.fVariantCount, info.fMimeType);
info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, info.fMimeDescription);
info.fExtensionArray = MakeStringArray(info.fVariantCount, info.fExtensions);
//info.fFileName = PL_strdup(fileName);
info.fFileName = PL_strdup(path); // don't we need the full path too?
info.fFileName = PL_strdup(path);
}
else
res = NS_ERROR_FAILURE;

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

@ -32,12 +32,18 @@
* scan the plugins directory. An nsPluginFileSpec can be constructed from the
* nsFileSpec returned by the iterator.
*/
/* Where to seek for plugins dir */
#define PLUGINS_DIR_LOCATION_AUTO 0
#define PLUGINS_DIR_LOCATION_MOZ_LOCAL 1
#define PLUGINS_DIR_LOCATION_4DOTX 2
class nsPluginsDir : public nsFileSpec {
public:
/**
* Locates the plugins directory in a platform-dependent manner.
*/
nsPluginsDir();
nsPluginsDir(PRUint16 location = PLUGINS_DIR_LOCATION_AUTO);
virtual ~nsPluginsDir();
/**

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

@ -51,7 +51,7 @@ static nsresult getApplicationSpec(FSSpec& outAppSpec)
return (result == noErr ? NS_OK : NS_ERROR_FAILURE);
}
nsPluginsDir::nsPluginsDir()
nsPluginsDir::nsPluginsDir(PRUint16 location)
{
#if 0
// Use the folder manager to get location of Extensions folder, and

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

@ -107,7 +107,7 @@ static char **BuildStringArray( char *aFlat, PRUint32 &aSize)
// nsPluginsDir class
nsPluginsDir::nsPluginsDir()
nsPluginsDir::nsPluginsDir(PRUint16 location)
{
// XXX This isn't right for the embedded case, but it's as close
// as we can do right now.

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

@ -69,7 +69,7 @@ static PRUint32 CalculateVariantCount(char* mimeTypes)
/* nsPluginsDir implementation */
nsPluginsDir::nsPluginsDir()
nsPluginsDir::nsPluginsDir(PRUint16 location)
{
// this is somewhat lacking, in that it doesn't fall back to any other directories.
// then again, I'm not sure we should be falling back at all. plugins have been (and probably

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

@ -119,45 +119,46 @@ static char** MakeStringArray(PRUint32 variants, char* data)
/* nsPluginsDir implementation */
nsPluginsDir::nsPluginsDir()
nsPluginsDir::nsPluginsDir(PRUint16 location)
{
HKEY keyloc;
DWORD pathlen, type;
long result;
DWORD pathlen;
char path[2000];
const char* allocPath;
//PRDir *dir = nsnull;
// first, let's look for a plugin folder that exists in the
// same directory as our executable
if (::GetModuleFileName(NULL, path, sizeof(path)) > 0)
{
pathlen = PL_strlen(path) - 1;
while (pathlen > 0)
if((location == PLUGINS_DIR_LOCATION_AUTO) || (location == PLUGINS_DIR_LOCATION_MOZ_LOCAL))
{
// look for a plugin folder that exists in the same directory as our executable
if (::GetModuleFileName(NULL, path, sizeof(path)) > 0)
{
if (path[pathlen] == '\\')
break;
pathlen = PL_strlen(path) - 1;
pathlen--;
}
while (pathlen > 0)
{
if (path[pathlen] == '\\')
break;
if (pathlen > 0)
{
PL_strcpy(&path[pathlen + 1], "plugins");
//dir = PR_OpenDir(path);
pathlen--;
}
allocPath = path;//PL_strdup(path);
*(nsFileSpec*)this = allocPath;
if (pathlen > 0)
{
PL_strcpy(&path[pathlen + 1], "plugins");
allocPath = path;
*(nsFileSpec*)this = allocPath;
}
}
}
}
if(((location == PLUGINS_DIR_LOCATION_AUTO) && !Exists()) ||
(location == PLUGINS_DIR_LOCATION_4DOTX))
{
// look for the plugin folder that the user has in their Communicator 4x install
HKEY keyloc;
long result;
DWORD type;
// if we didn't find it, let's look for the plugin folder
// that the user has in their Communicator 4x install
if(!Exists())
{
path[0] = 0;
//PL_strfree(allocPath);
result = ::RegOpenKeyEx(HKEY_CURRENT_USER,
"Software\\Netscape\\Netscape Navigator\\Main",
@ -178,10 +179,9 @@ nsPluginsDir::nsPluginsDir()
::RegCloseKey(keyloc);
}
//dir = PR_OpenDir(path);
allocPath = PL_strdup(path);
*(nsFileSpec*)this = allocPath;
}
}
#ifdef NS_DEBUG
if (path[0] != 0)
@ -285,12 +285,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
DWORD zerome, versionsize;
char* verbuf = nsnull;
const char* path = this->GetCString();
/*
const char* fileName;
fileName = PL_strrchr(path, '\\');
if(fileName)
++fileName;
*/
versionsize = ::GetFileVersionInfoSize((char*)path, &zerome);
if (versionsize > 0)
verbuf = (char *)PR_Malloc(versionsize);
@ -310,8 +305,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
info.fMimeTypeArray = MakeStringArray(info.fVariantCount, info.fMimeType);
info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, info.fMimeDescription);
info.fExtensionArray = MakeStringArray(info.fVariantCount, info.fExtensions);
//info.fFileName = PL_strdup(fileName);
info.fFileName = PL_strdup(path); // don't we need the full path too?
info.fFileName = PL_strdup(path);
}
else
res = NS_ERROR_FAILURE;