Commit 9ac8c0d8 authored by ahern's avatar ahern
Browse files

I changed the way the plugin directories can be set.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@2991 18c085ea-50e0-402c-830e-de6fd14e8384
parent 3261d403
......@@ -68,12 +68,14 @@ DatabasePluginManager *DatabasePluginManager::instance=0;
// I made it call SetPluginDir since it's no longer done in the base
// class's constructor.
//
// Sean Ahern, Thu Jan 17 16:06:20 EST 2008
// Moved the call to SetPluginDir to Initialize to make it conform
// with the rest of the plugin managers.
//
// ****************************************************************************
DatabasePluginManager::DatabasePluginManager() : PluginManager("database")
{
// Make it use VISITPLUGINDIR.
SetPluginDir(0);
}
// ****************************************************************************
......@@ -104,16 +106,21 @@ DatabasePluginManager::~DatabasePluginManager()
// Creation: August 22, 2002
//
// Modifications:
// Sean Ahern, Thu Jan 17 16:10:00 EST 2008
// Added SetPluginDir so that we can find plugins correctly. Arguably,
// this is better here than the constructor.
//
// ****************************************************************************
void
DatabasePluginManager::Initialize(const PluginCategory pluginCategory,
bool parallel)
bool parallel,
const char * pluginDir)
{
Instance();
instance->category = pluginCategory;
instance->parallel = parallel;
instance->SetPluginDir(pluginDir);
instance->ReadPluginInfo();
}
......
......@@ -77,6 +77,11 @@ class EngineDatabasePluginInfo;
//
// Mark C. Miller, Thu Aug 9 09:16:01 PDT 2007
// Made GetMatchingPluginIds return a vector of strings
//
// Sean Ahern, Thu Jan 17 16:40:08 EST 2008
// Added a pluginDir argument to Initialize to make it conform to the other
// plugin managers.
//
// ****************************************************************************
class PLUGIN_API DatabasePluginManager : public PluginManager
......@@ -84,7 +89,9 @@ class PLUGIN_API DatabasePluginManager : public PluginManager
public:
virtual ~DatabasePluginManager();
static void Initialize(const PluginCategory, bool=false);
static void Initialize(const PluginCategory, bool parallel=false,
const char *pluginDir=0);
static DatabasePluginManager *Instance();
virtual void ReloadPlugins();
......
......@@ -1409,29 +1409,49 @@ void *dlsym(void *handle, const char *symbol)
// Brad Whitlock, Wed Nov 22 16:25:19 PST 2006
// I made it possible to pass in the plugin directory. If it does not
// get passed in (the default) then we use VISITPLUGINDIR.
//
// Sean Ahern, Thu Jan 17 15:52:42 EST 2008
// Only fail the environment exception if the plugin directory hasn't been
// set in a prior call to SetPluginDir.
//
// ****************************************************************************
void
PluginManager::SetPluginDir(const char *PluginDir)
{
// Get the plugin directory from the environment.
const char *plugindir = 0;
if(PluginDir == 0)
if (PluginDir == 0)
{
// Get the plugin directory from the environment.
plugindir = getenv("VISITPLUGINDIR");
if (!plugindir)
{
// No environment variable found. If we have directories in the
// list already, this isn't a problem.
if (pluginDirs.empty())
{
debug5 << "No environment variable!" << endl;
#if defined(_WIN32)
plugindir = "C:\\VisItWindows\\bin";
plugindir = "C:\\VisItWindows\\bin";
#else
EXCEPTION1(VisItException,
"The environment variable VISITPLUGINDIR must be defined.");
EXCEPTION1(VisItException,
"The environment variable VISITPLUGINDIR must be defined.");
#endif
}
else
{
// The pluginDirs list is already populated. So not having an
// environment variable is okay. We got the list from somewhere
// else (-plugindir option?).
return;
}
}
}
else
{
// Manually set the plugin directory.
plugindir = PluginDir;
}
#if defined(_WIN32)
pluginDirs.push_back(string(plugindir) + SLASH_STRING + managerName + "s");
......
......@@ -91,6 +91,10 @@
// Hank Childs, Fri Oct 5 13:10:38 PDT 2007
// Changed argument for ReadPluginDir.
//
// Sean Ahern, Thu Jan 17 15:12:09 EST 2008
// Made SetPluginDir be a public function so we can change the directory if
// we need to.
//
// ****************************************************************************
class PLUGIN_API PluginManager
......@@ -134,11 +138,11 @@ class PLUGIN_API PluginManager
int GetEnabledIndex(const std::string &);
std::string GetPluginInitializationErrors();
void SetPluginDir(const char *dir = 0);
protected:
PluginManager(const std::string&);
void ReadPluginInfo();
void SetPluginDir(const char *);
void ReadPluginDir(std::vector<
std::vector<
std::pair<std::string,
......
......@@ -351,6 +351,7 @@ Engine::Initialize(int *argc, char **argv[], bool sigs)
debug1 << "ENGINE started\n";
#ifdef PARALLEL
cerr << "ENGINE is MPI task " << PAR_Rank() << endl;
visitTimer->StopTimer(initTimer, "Initializing the engine (including MPI_Init())");
#else
visitTimer->StopTimer(initTimer, "Initializing the engine");
......@@ -1089,6 +1090,10 @@ Engine::ProcessInput()
// Made to use putenv instead of setenv if on Windows or HAVE_SETENV is
// not defined.
//
// Sean Ahern, Thu Jan 17 16:34:14 EST 2008
// Got rid of the setenv thing entirely and instead called SetPluginDir on
// the individual plugin managers.
//
// ****************************************************************************
void
......@@ -1243,15 +1248,10 @@ Engine::ProcessCommandLine(int argc, char **argv)
}
else if (strcmp(argv[i], "-plugindir") == 0 && (i+1) < argc )
{
#if defined(WIN32) || !defined(HAVE_SETENV)
char *pluginDir = new char[strlen(argv[i+1])+1+30];
sprintf(pluginDir, "VISITPLUGINDIR=%s", argv[i+1]);
putenv(pluginDir);
delete [] pluginDir;
#else
setenv( "VISITPLUGINDIR", argv[i+1], 1 );
#endif
++i;
PlotPluginManager::Instance()->SetPluginDir(argv[i+1]);
OperatorPluginManager::Instance()->SetPluginDir(argv[i+1]);
DatabasePluginManager::Instance()->SetPluginDir(argv[i+1]);
++i;
}
}
......@@ -2173,7 +2173,7 @@ Engine::EngineWarningCallback(void *data, const char *msg)
if (!rpc)
{
debug1 << "EngineWarningCallback called with no RPC set. Message was..." << endl;
debug1 << msg << endl;
debug1 << msg << endl;
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment