Added support for multiple module directories, can be specified from the
command line. git-svn-id: http://yate.null.ro/svn/yate/trunk@1405 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
8cc4f40ab4
commit
6f2c70aa86
|
@ -37,7 +37,7 @@ extern "C" int main(int argc, const char** argv, const char** envp)
|
||||||
bool fail = !gtk_init_check(&argc,(char ***)&argv);
|
bool fail = !gtk_init_check(&argc,(char ***)&argv);
|
||||||
if (fail)
|
if (fail)
|
||||||
g_warning("Cannot open display: '%s'",gdk_get_display());
|
g_warning("Cannot open display: '%s'",gdk_get_display());
|
||||||
TelEngine::Engine::extraPath() = "gtk2";
|
TelEngine::Engine::extraPath("gtk2");
|
||||||
return TelEngine::Engine::main(argc,argv,envp,TelEngine::Engine::Client,fail);
|
return TelEngine::Engine::main(argc,argv,envp,TelEngine::Engine::Client,fail);
|
||||||
}
|
}
|
||||||
/* vi: set ts=8 sw=4 sts=4 noet: */
|
/* vi: set ts=8 sw=4 sts=4 noet: */
|
||||||
|
|
|
@ -136,8 +136,8 @@ static void sighandler(int signal)
|
||||||
String Engine::s_cfgpath(CFG_PATH);
|
String Engine::s_cfgpath(CFG_PATH);
|
||||||
String Engine::s_cfgsuffix(CFG_SUFFIX);
|
String Engine::s_cfgsuffix(CFG_SUFFIX);
|
||||||
String Engine::s_modpath(MOD_PATH);
|
String Engine::s_modpath(MOD_PATH);
|
||||||
String Engine::s_extramod;
|
|
||||||
String Engine::s_modsuffix(DLL_SUFFIX);
|
String Engine::s_modsuffix(DLL_SUFFIX);
|
||||||
|
ObjList Engine::s_extramod;
|
||||||
|
|
||||||
Engine::RunMode Engine::s_mode = Engine::Stopped;
|
Engine::RunMode Engine::s_mode = Engine::Stopped;
|
||||||
Engine* Engine::s_self = 0;
|
Engine* Engine::s_self = 0;
|
||||||
|
@ -863,9 +863,7 @@ void Engine::loadPlugins()
|
||||||
const char *name = s_cfg.getValue("general","modpath");
|
const char *name = s_cfg.getValue("general","modpath");
|
||||||
if (name)
|
if (name)
|
||||||
s_modpath = name;
|
s_modpath = name;
|
||||||
name = s_cfg.getValue("general","extrapath");
|
extraPath(s_cfg.getValue("general","extrapath"));
|
||||||
if (name)
|
|
||||||
s_extramod = name;
|
|
||||||
s_maxworkers = s_cfg.getIntValue("general","maxworkers",s_maxworkers);
|
s_maxworkers = s_cfg.getIntValue("general","maxworkers",s_maxworkers);
|
||||||
s_restarts = s_cfg.getIntValue("general","restarts");
|
s_restarts = s_cfg.getIntValue("general","restarts");
|
||||||
m_dispatcher.warnTime(1000*(u_int64_t)s_cfg.getIntValue("general","warntime"));
|
m_dispatcher.warnTime(1000*(u_int64_t)s_cfg.getIntValue("general","warntime"));
|
||||||
|
@ -879,8 +877,10 @@ void Engine::loadPlugins()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadPluginDir(String::empty());
|
loadPluginDir(String::empty());
|
||||||
if (s_extramod)
|
while (GenObject* extra = s_extramod.remove(false)) {
|
||||||
loadPluginDir(s_extramod);
|
loadPluginDir(extra->toString());
|
||||||
|
extra->destruct();
|
||||||
|
}
|
||||||
l = s_cfg.getSection("postload");
|
l = s_cfg.getSection("postload");
|
||||||
if (l) {
|
if (l) {
|
||||||
unsigned int len = l->length();
|
unsigned int len = l->length();
|
||||||
|
@ -916,6 +916,13 @@ int Engine::usedPlugins()
|
||||||
return used;
|
return used;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine::extraPath(const String& path)
|
||||||
|
{
|
||||||
|
if (path.null() || s_extramod.find(path))
|
||||||
|
return;
|
||||||
|
s_extramod.append(new String(path));
|
||||||
|
}
|
||||||
|
|
||||||
void Engine::halt(unsigned int code)
|
void Engine::halt(unsigned int code)
|
||||||
{
|
{
|
||||||
if (s_haltcode == -1)
|
if (s_haltcode == -1)
|
||||||
|
@ -990,6 +997,7 @@ static void usage(bool client, FILE* f)
|
||||||
" -n configname Use specified configuration name (%s)\n"
|
" -n configname Use specified configuration name (%s)\n"
|
||||||
" -c pathname Path to conf files directory (" CFG_PATH ")\n"
|
" -c pathname Path to conf files directory (" CFG_PATH ")\n"
|
||||||
" -m pathname Path to modules directory (" MOD_PATH ")\n"
|
" -m pathname Path to modules directory (" MOD_PATH ")\n"
|
||||||
|
" -x relpath Relative path to extra modules directory (can be repeated)\n"
|
||||||
" -w directory Change working directory\n"
|
" -w directory Change working directory\n"
|
||||||
#ifdef RLIMIT_CORE
|
#ifdef RLIMIT_CORE
|
||||||
" -C Enable core dumps if possible\n"
|
" -C Enable core dumps if possible\n"
|
||||||
|
@ -1176,6 +1184,14 @@ int Engine::main(int argc, const char** argv, const char** env, RunMode mode, bo
|
||||||
pc = 0;
|
pc = 0;
|
||||||
workdir = argv[++i];
|
workdir = argv[++i];
|
||||||
break;
|
break;
|
||||||
|
case 'x':
|
||||||
|
if (i+1 >= argc) {
|
||||||
|
noarg(client,argv[i]);
|
||||||
|
return ENOENT;
|
||||||
|
}
|
||||||
|
pc = 0;
|
||||||
|
extraPath(argv[++i]);
|
||||||
|
break;
|
||||||
#ifdef RLIMIT_CORE
|
#ifdef RLIMIT_CORE
|
||||||
case 'C':
|
case 'C':
|
||||||
s_coredump = true;
|
s_coredump = true;
|
||||||
|
|
6
yate.8
6
yate.8
|
@ -64,6 +64,12 @@ Path to conf files directory, overrides compiled-in value
|
||||||
.TP
|
.TP
|
||||||
.B \-m \fIpathname\fR
|
.B \-m \fIpathname\fR
|
||||||
Path to modules directory, overrides compiled-in value
|
Path to modules directory, overrides compiled-in value
|
||||||
|
.TP
|
||||||
|
.B \-x \fIrelpath\fR
|
||||||
|
Relative path to extra modules directory (can be repeated)
|
||||||
|
.TP
|
||||||
|
.B \-w \fIdirectory\fR
|
||||||
|
Change working directory
|
||||||
.SS Debugging options (may not be compiled in)
|
.SS Debugging options (may not be compiled in)
|
||||||
.TP
|
.TP
|
||||||
.B \-C
|
.B \-C
|
||||||
|
|
10
yatengine.h
10
yatengine.h
|
@ -781,11 +781,11 @@ public:
|
||||||
{ return s_modpath; }
|
{ return s_modpath; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The relative extra module loading path. This is empty by default but
|
* Add a relative extra module loading path. The list is empty by default
|
||||||
* can be set by a main program to a value before calling @ref main()
|
* but can be filled by a main program before calling @ref main()
|
||||||
|
* @param path Relative path to extra modules to be loaded
|
||||||
*/
|
*/
|
||||||
inline static String& extraPath()
|
static void extraPath(const String& path);
|
||||||
{ return s_extramod; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the module filename suffix
|
* Get the module filename suffix
|
||||||
|
@ -961,8 +961,8 @@ private:
|
||||||
static String s_cfgpath;
|
static String s_cfgpath;
|
||||||
static String s_cfgsuffix;
|
static String s_cfgsuffix;
|
||||||
static String s_modpath;
|
static String s_modpath;
|
||||||
static String s_extramod;
|
|
||||||
static String s_modsuffix;
|
static String s_modsuffix;
|
||||||
|
static ObjList s_extramod;
|
||||||
static int s_haltcode;
|
static int s_haltcode;
|
||||||
static RunMode s_mode;
|
static RunMode s_mode;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue