1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-21 11:09:41 +00:00

added --version command line option

This commit is contained in:
Marc Zinnschlag 2011-07-08 16:16:20 +02:00
parent a7b266c4d2
commit d9a25427c5

View file

@ -26,6 +26,8 @@
#endif #endif
#include "config.hpp"
using namespace std; using namespace std;
/// Parse command line options and openmw.cfg file (if one exists). Results are directly /// Parse command line options and openmw.cfg file (if one exists). Results are directly
@ -41,7 +43,8 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
"Syntax: openmw <options>\nAllowed options"); "Syntax: openmw <options>\nAllowed options");
desc.add_options() desc.add_options()
("help", "print help message") ("help", "print help message and quit")
("version", "print version information and quit")
("data", bpo::value<std::vector<std::string> >() ("data", bpo::value<std::vector<std::string> >()
->default_value (std::vector<std::string>(), "data") ->default_value (std::vector<std::string>(), "data")
->multitoken(), ->multitoken(),
@ -105,12 +108,23 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine)
if (globalConfigFile.is_open()) if (globalConfigFile.is_open())
bpo::store ( bpo::parse_config_file (globalConfigFile, desc), variables); bpo::store ( bpo::parse_config_file (globalConfigFile, desc), variables);
bool run = true;
if (variables.count ("help")) if (variables.count ("help"))
{ {
std::cout << desc << std::endl; std::cout << desc << std::endl;
return false; run = false;
} }
if (variables.count ("version"))
{
std::cout << "OpenMW version " << OPENMW_VERSION << std::endl;
run = false;
}
if (!run)
return false;
// directory settings // directory settings
if (variables["fs-strict"].as<bool>()==true) if (variables["fs-strict"].as<bool>()==true)
engine.enableFSStrict(); engine.enableFSStrict();