From d9a25427c5c9d9d2b747e8014e9b99bcad7a291b Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 8 Jul 2011 16:16:20 +0200 Subject: [PATCH] added --version command line option --- apps/openmw/main.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 56f78afe3..c3d0cc821 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -26,6 +26,8 @@ #endif +#include "config.hpp" + using namespace std; /// 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 \nAllowed options"); desc.add_options() - ("help", "print help message") + ("help", "print help message and quit") + ("version", "print version information and quit") ("data", bpo::value >() ->default_value (std::vector(), "data") ->multitoken(), @@ -105,12 +108,23 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine) if (globalConfigFile.is_open()) bpo::store ( bpo::parse_config_file (globalConfigFile, desc), variables); + bool run = true; + if (variables.count ("help")) { 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 if (variables["fs-strict"].as()==true) engine.enableFSStrict();