Add silent mode to ConfigurationManager, used by essimporter

openmw-35
scrawl 10 years ago
parent e7056b4e27
commit ef3ba12cb6

@ -45,7 +45,7 @@ int main(int argc, char** argv)
bpo::notify(variables);
Files::ConfigurationManager cfgManager;
Files::ConfigurationManager cfgManager(true);
cfgManager.readConfiguration(variables, desc);
std::string essFile = variables["mwsave"].as<std::string>();

@ -27,8 +27,9 @@ const char* const localToken = "?local?";
const char* const userDataToken = "?userdata?";
const char* const globalToken = "?global?";
ConfigurationManager::ConfigurationManager()
ConfigurationManager::ConfigurationManager(bool silent)
: mFixedPath(applicationName)
, mSilent(silent)
{
setupTokensMapping();
@ -129,7 +130,8 @@ void ConfigurationManager::loadConfig(const boost::filesystem::path& path,
cfgFile /= std::string(openmwCfgFile);
if (boost::filesystem::is_regular_file(cfgFile))
{
std::cout << "Loading config file: " << cfgFile.string() << "... ";
if (!mSilent)
std::cout << "Loading config file: " << cfgFile.string() << "... ";
boost::filesystem::ifstream configFileStream(cfgFile);
if (configFileStream.is_open())
@ -137,11 +139,13 @@ void ConfigurationManager::loadConfig(const boost::filesystem::path& path,
boost::program_options::store(boost::program_options::parse_config_file(
configFileStream, description, true), variables);
std::cout << "done." << std::endl;
if (!mSilent)
std::cout << "done." << std::endl;
}
else
{
std::cout << "failed." << std::endl;
if (!mSilent)
std::cout << "failed." << std::endl;
}
}
}

@ -25,7 +25,7 @@ namespace Files
*/
struct ConfigurationManager
{
ConfigurationManager();
ConfigurationManager(bool silent=false); /// @param silent Emit log messages to cout?
virtual ~ConfigurationManager();
void readConfiguration(boost::program_options::variables_map& variables,
@ -69,6 +69,8 @@ struct ConfigurationManager
boost::filesystem::path mLogPath;
TokensMappingContainer mTokensMapping;
bool mSilent;
};
} /* namespace Cfg */

Loading…
Cancel
Save