Print application paths for --version

fixes #6783
This commit is contained in:
Gunnar Beutner 2014-07-23 09:30:56 +02:00
parent 2d6ed4c9be
commit 4724869e1c
3 changed files with 27 additions and 19 deletions

View File

@ -482,8 +482,13 @@ int Main(void)
std::cout << std::endl;
if (g_AppParams.count("version"))
if (g_AppParams.count("version")) {
std::cout << std::endl;
Application::DisplayInfoMessage(true);
return EXIT_SUCCESS;
}
}
if (g_AppParams.count("help")) {

View File

@ -451,21 +451,23 @@ String Application::GetExePath(const String& argv0)
}
/**
* Display version information.
* Display version and path information.
*/
void Application::DisplayVersionMessage(void)
void Application::DisplayInfoMessage(bool skipVersion)
{
std::cerr << "***" << std::endl
<< "* Application version: " << GetVersion() << std::endl
<< "* Installation root: " << GetPrefixDir() << std::endl
<< "* Sysconf directory: " << GetSysconfDir() << std::endl
<< "* Run directory: " << GetRunDir() << std::endl
<< "* Local state directory: " << GetLocalStateDir() << std::endl
<< "* Package data directory: " << GetPkgDataDir() << std::endl
<< "* State path: " << GetStatePath() << std::endl
<< "* PID path: " << GetPidPath() << std::endl
<< "* Application type: " << GetApplicationType() << std::endl
<< "***" << std::endl;
std::cerr << "Application information:" << std::endl;
if (!skipVersion)
std::cerr << "* Application version: " << GetVersion() << std::endl;
std::cerr << " Installation root: " << GetPrefixDir() << std::endl
<< " Sysconf directory: " << GetSysconfDir() << std::endl
<< " Run directory: " << GetRunDir() << std::endl
<< " Local state directory: " << GetLocalStateDir() << std::endl
<< " Package data directory: " << GetPkgDataDir() << std::endl
<< " State path: " << GetStatePath() << std::endl
<< " PID path: " << GetPidPath() << std::endl
<< " Application type: " << GetApplicationType() << std::endl;
}
/**
@ -531,7 +533,7 @@ void Application::SigAbrtHandler(int)
<< "Current time: " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", Utility::GetTime()) << std::endl
<< std::endl;
DisplayVersionMessage();
DisplayInfoMessage();
StackTrace trace;
std::cerr << "Stacktrace:" << std::endl;
@ -574,7 +576,7 @@ void Application::ExceptionHandler(void)
<< "Current time: " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", Utility::GetTime()) << std::endl
<< std::endl;
DisplayVersionMessage();
DisplayInfoMessage();
try {
RethrowUncaughtException();
@ -592,7 +594,7 @@ void Application::ExceptionHandler(void)
#ifdef _WIN32
LONG CALLBACK Application::SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi)
{
DisplayVersionMessage();
DisplayInfoMessage();
std::cerr << "Caught unhandled SEH exception." << std::endl
<< "Current time: " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", Utility::GetTime()) << std::endl

View File

@ -117,6 +117,8 @@ public:
static double GetStartTime(void);
static void SetStartTime(double ts);
static void DisplayInfoMessage(bool skipVersion = false);
protected:
virtual void OnConfigLoaded(void);
virtual void Stop(void);
@ -126,7 +128,7 @@ protected:
pid_t StartReloadProcess(void);
virtual void OnShutdown(void);
private:
static Application *m_Instance; /**< The application instance. */
@ -151,7 +153,6 @@ private:
static LONG WINAPI SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi);
#endif /* _WIN32 */
static void DisplayVersionMessage(void);
static void DisplayBugMessage(void);
static void SigAbrtHandler(int signum);