From 3e62adcadd915e26df37e16cdb784573ac44fd9b Mon Sep 17 00:00:00 2001 From: Pieter Hulshoff Date: Wed, 24 Aug 2016 12:36:47 +0200 Subject: [PATCH] Build 0.7.3: Added version number support in Version.cpp; this file should be updated for each new build. Added -version command line option so people can print the version of RetroFE without running the actual front-end. --- RetroFE/Source/Main.cpp | 26 ++++++++++++++++++++++++++ RetroFE/Source/Version.cpp | 32 ++++++-------------------------- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/RetroFE/Source/Main.cpp b/RetroFE/Source/Main.cpp index 34588a9..c7c1c47 100644 --- a/RetroFE/Source/Main.cpp +++ b/RetroFE/Source/Main.cpp @@ -31,6 +31,32 @@ static bool StartLogging(); int main(int argc, char **argv) { + + // check to see if version or help was requested + if(argc > 1) + { + std::string program = argv[0]; + std::string param = argv[1]; + + if(argc == 3 && param == "-createcollection") + { + // Do nothing; we handle that later + } + else if(param == "-version") + { + std::cout << "RetroFE version " << Version::getString( ) << std::endl; + return 0; + } + else + { + std::cout << "Usage:" << std::endl; + std::cout << program << " Run RetroFE" << std::endl; + std::cout << program << " -version Print the version of RetroFE." << std::endl; + std::cout << program << " -createcollection Create a collection directory structure." << std::endl; + return 0; + } + } + // Initialize random seed srand(static_cast(time(0))); diff --git a/RetroFE/Source/Version.cpp b/RetroFE/Source/Version.cpp index b580215..41d2984 100644 --- a/RetroFE/Source/Version.cpp +++ b/RetroFE/Source/Version.cpp @@ -15,36 +15,16 @@ */ #include "Version.h" -#include +#include -#ifndef RETROFE_VERSION_MAJOR -#define RETROFE_VERSION_MAJOR 0 -#endif -#ifndef RETROFE_VERSION_MINOR -#define RETROFE_VERSION_MINOR 0 -#endif +std::string retrofe_version_major = "0"; +std::string retrofe_version_minor = "7"; +std::string retrofe_version_build = "3"; -#ifndef RETROFE_VERSION_BUILD -#define RETROFE_VERSION_BUILD 0 -#endif - -#ifndef RETROFE_VERSION_PROD -#define RETROFE_VERSION_BETA -#endif std::string Version::getString() { - std::stringstream version; - version << RETROFE_VERSION_MAJOR; - version << "."; - version << RETROFE_VERSION_MINOR; - version << "."; - version << RETROFE_VERSION_BUILD; - -#ifdef RETROFE_VERSION_BETA - version << "-beta"; -#endif - - return version.str(); + std::string return_string = retrofe_version_major + "." + retrofe_version_minor + "." + retrofe_version_build; + return return_string; }