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,9 +482,14 @@ int Main(void)
std::cout << std::endl; std::cout << std::endl;
if (g_AppParams.count("version")) if (g_AppParams.count("version")) {
std::cout << std::endl;
Application::DisplayInfoMessage(true);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
}
if (g_AppParams.count("help")) { if (g_AppParams.count("help")) {
std::cout << std::endl std::cout << std::endl

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 std::cerr << "Application information:" << std::endl;
<< "* Application version: " << GetVersion() << std::endl
<< "* Installation root: " << GetPrefixDir() << std::endl if (!skipVersion)
<< "* Sysconf directory: " << GetSysconfDir() << std::endl std::cerr << "* Application version: " << GetVersion() << std::endl;
<< "* Run directory: " << GetRunDir() << std::endl
<< "* Local state directory: " << GetLocalStateDir() << std::endl std::cerr << " Installation root: " << GetPrefixDir() << std::endl
<< "* Package data directory: " << GetPkgDataDir() << std::endl << " Sysconf directory: " << GetSysconfDir() << std::endl
<< "* State path: " << GetStatePath() << std::endl << " Run directory: " << GetRunDir() << std::endl
<< "* PID path: " << GetPidPath() << std::endl << " Local state directory: " << GetLocalStateDir() << std::endl
<< "* Application type: " << GetApplicationType() << std::endl << " Package data directory: " << GetPkgDataDir() << std::endl
<< "***" << 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 << "Current time: " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", Utility::GetTime()) << std::endl
<< std::endl; << std::endl;
DisplayVersionMessage(); DisplayInfoMessage();
StackTrace trace; StackTrace trace;
std::cerr << "Stacktrace:" << std::endl; 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 << "Current time: " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", Utility::GetTime()) << std::endl
<< std::endl; << std::endl;
DisplayVersionMessage(); DisplayInfoMessage();
try { try {
RethrowUncaughtException(); RethrowUncaughtException();
@ -592,7 +594,7 @@ void Application::ExceptionHandler(void)
#ifdef _WIN32 #ifdef _WIN32
LONG CALLBACK Application::SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi) LONG CALLBACK Application::SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi)
{ {
DisplayVersionMessage(); DisplayInfoMessage();
std::cerr << "Caught unhandled SEH exception." << std::endl std::cerr << "Caught unhandled SEH exception." << std::endl
<< "Current time: " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", Utility::GetTime()) << 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 double GetStartTime(void);
static void SetStartTime(double ts); static void SetStartTime(double ts);
static void DisplayInfoMessage(bool skipVersion = false);
protected: protected:
virtual void OnConfigLoaded(void); virtual void OnConfigLoaded(void);
virtual void Stop(void); virtual void Stop(void);
@ -151,7 +153,6 @@ private:
static LONG WINAPI SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi); static LONG WINAPI SEHUnhandledExceptionFilter(PEXCEPTION_POINTERS exi);
#endif /* _WIN32 */ #endif /* _WIN32 */
static void DisplayVersionMessage(void);
static void DisplayBugMessage(void); static void DisplayBugMessage(void);
static void SigAbrtHandler(int signum); static void SigAbrtHandler(int signum);