Config file missing warning can be disabled, use it to silence notices about files that are genuinely missing from a fresh install.
git-svn-id: http://voip.null.ro/svn/yate@2098 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
0205f0b6da
commit
9f0161d689
|
@ -31,10 +31,10 @@ Configuration::Configuration()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Configuration::Configuration(const char* filename)
|
Configuration::Configuration(const char* filename, bool warn)
|
||||||
: String(filename)
|
: String(filename)
|
||||||
{
|
{
|
||||||
load();
|
load(warn);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjList* Configuration::getSectHolder(const String& sect) const
|
ObjList* Configuration::getSectHolder(const String& sect) const
|
||||||
|
@ -153,7 +153,7 @@ void Configuration::setValue(const String& sect, const char* key, bool value)
|
||||||
setValue(sect,key,String::boolText(value));
|
setValue(sect,key,String::boolText(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Configuration::load()
|
bool Configuration::load(bool warn)
|
||||||
{
|
{
|
||||||
m_sections.clear();
|
m_sections.clear();
|
||||||
if (null())
|
if (null())
|
||||||
|
@ -196,9 +196,11 @@ bool Configuration::load()
|
||||||
::fclose(f);
|
::fclose(f);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int err = errno;
|
if (warn) {
|
||||||
Debug(DebugNote,"Failed to open config file '%s', using defaults (%d: %s)",
|
int err = errno;
|
||||||
c_str(),err,strerror(err));
|
Debug(DebugNote,"Failed to open config file '%s', using defaults (%d: %s)",
|
||||||
|
c_str(),err,strerror(err));
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -515,8 +515,11 @@ bool CmdHandler::doCommand(String& line, String& rval)
|
||||||
}
|
}
|
||||||
else if (line == "load") {
|
else if (line == "load") {
|
||||||
s_mutex.lock();
|
s_mutex.lock();
|
||||||
s_cfg.load();
|
bool ok = s_cfg.load(false);
|
||||||
rval << "Loaded config from " << s_cfg;
|
if (ok)
|
||||||
|
rval << "Loaded config from " << s_cfg;
|
||||||
|
else
|
||||||
|
rval << "Failed to load from " << s_cfg;
|
||||||
s_mutex.unlock();
|
s_mutex.unlock();
|
||||||
}
|
}
|
||||||
else if (line == "save") {
|
else if (line == "save") {
|
||||||
|
@ -612,7 +615,7 @@ void CallGenPlugin::initialize()
|
||||||
Output("Initializing module Call Generator");
|
Output("Initializing module Call Generator");
|
||||||
s_mutex.lock();
|
s_mutex.lock();
|
||||||
s_cfg = Engine::configFile("callgen",Engine::clientMode());
|
s_cfg = Engine::configFile("callgen",Engine::clientMode());
|
||||||
s_cfg.load();
|
s_cfg.load(false);
|
||||||
s_mutex.unlock();
|
s_mutex.unlock();
|
||||||
if (m_first) {
|
if (m_first) {
|
||||||
m_first = false;
|
m_first = false;
|
||||||
|
|
|
@ -1402,7 +1402,7 @@ void SigDriver::initialize()
|
||||||
// Startup
|
// Startup
|
||||||
if (!m_engine) {
|
if (!m_engine) {
|
||||||
s_cfgData = Engine::configFile("ysigdata");
|
s_cfgData = Engine::configFile("ysigdata");
|
||||||
s_cfgData.load();
|
s_cfgData.load(false);
|
||||||
setup();
|
setup();
|
||||||
installRelay(Masquerade);
|
installRelay(Masquerade);
|
||||||
installRelay(Halt);
|
installRelay(Halt);
|
||||||
|
|
|
@ -51,8 +51,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* Create a configuration from a file
|
* Create a configuration from a file
|
||||||
* @param filename Name of file to initialize from
|
* @param filename Name of file to initialize from
|
||||||
|
* @param warn True to warn if the configuration could not be loaded
|
||||||
*/
|
*/
|
||||||
Configuration(const char* filename);
|
Configuration(const char* filename, bool warn = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assignment from string operator
|
* Assignment from string operator
|
||||||
|
@ -189,9 +190,10 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the configuration from file
|
* Load the configuration from file
|
||||||
|
* @param warn True to also warn if the configuration could not be loaded
|
||||||
* @return True if successfull, false for failure
|
* @return True if successfull, false for failure
|
||||||
*/
|
*/
|
||||||
bool load();
|
bool load(bool warn = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the configuration to file
|
* Save the configuration to file
|
||||||
|
|
Loading…
Reference in New Issue