App: Add utility method to get app name with version included
This commit is contained in:
committed by
WandererFan
parent
b94aa0eb5f
commit
d2194bbeda
@@ -38,6 +38,7 @@
|
||||
# include <boost/scope_exit.hpp>
|
||||
# include <chrono>
|
||||
# include <random>
|
||||
# include <fmt/format.h>
|
||||
#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"];
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -102,6 +102,8 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/scope_exit.hpp>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#endif //_PreComp_
|
||||
|
||||
#endif // APP_PRECOMPILED_H
|
||||
|
||||
Reference in New Issue
Block a user