From d2194bbeda56f18bedb503cf50222567d11414a3 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Wed, 29 Jan 2025 10:50:19 +0100 Subject: [PATCH] App: Add utility method to get app name with version included --- src/App/Application.cpp | 12 ++++++++++++ src/App/Application.h | 1 + src/App/PreCompiled.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 0fc1cf62a2..0498634b8e 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -38,6 +38,7 @@ # include # include # include +# include #endif #ifdef FC_OS_WIN32 @@ -1145,6 +1146,17 @@ std::string Application::getExecutableName() return mConfig["ExeName"]; } +std::string Application::getNameWithVersion() +{ + auto appname = QCoreApplication::applicationName().toStdString(); + auto config = App::Application::Config(); + auto major = config["BuildVersionMajor"]; + auto minor = config["BuildVersionMinor"]; + auto point = config["BuildVersionPoint"]; + auto suffix = config["BuildVersionSuffix"]; + return fmt::format("{} {}.{}.{}{}", appname, major, minor, point, suffix); +} + std::string Application::getTempPath() { return mConfig["AppTempPath"]; diff --git a/src/App/Application.h b/src/App/Application.h index a2be53861b..2646737233 100644 --- a/src/App/Application.h +++ b/src/App/Application.h @@ -413,6 +413,7 @@ public: //@{ static std::string getHomePath(); static std::string getExecutableName(); + static std::string getNameWithVersion(); /*! Returns the temporary directory. By default, this is set to the system's temporary directory but can be customized by the user. diff --git a/src/App/PreCompiled.h b/src/App/PreCompiled.h index 66ec6e5a34..0523bf5744 100644 --- a/src/App/PreCompiled.h +++ b/src/App/PreCompiled.h @@ -102,6 +102,8 @@ #include #include +#include + #endif //_PreComp_ #endif // APP_PRECOMPILED_H