forked from mirror/openmw-tes3mp
Add silent mode to ConfigurationManager, used by essimporter
This commit is contained in:
parent
e7056b4e27
commit
ef3ba12cb6
3 changed files with 12 additions and 6 deletions
|
@ -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…
Reference in a new issue