From 83b63b71b9e25b4a71b56cc2a4c6eadbb20feb2f Mon Sep 17 00:00:00 2001 From: Giel van Schijndel Date: Sun, 13 Jul 2008 21:01:28 +0000 Subject: [PATCH] Add PhysicsFS version info to crash dump files git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5535 4a71c877-e1ca-e34f-864e-861f7616d084 --- lib/exceptionhandler/dumpinfo.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/exceptionhandler/dumpinfo.cpp b/lib/exceptionhandler/dumpinfo.cpp index 907b7b3c7..454940962 100644 --- a/lib/exceptionhandler/dumpinfo.cpp +++ b/lib/exceptionhandler/dumpinfo.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "dumpinfo.h" extern "C" @@ -120,6 +121,13 @@ static std::string getSysinfo() #endif } +static std::ostream& writePhysFSVersion(std::ostream& os, PHYSFS_Version const& ver) +{ + return os << static_cast(ver.major) + << "." << static_cast(ver.minor) + << "." << static_cast(ver.patch); +} + static void createHeader(const char* programCommand) { time_t currentTime = time(NULL); @@ -140,8 +148,19 @@ static void createHeader(const char* programCommand) #endif << "Executed on: " << ctime(¤tTime) << std::endl << getSysinfo() << std::endl - << "Pointers: " << (sizeof(void*) * CHAR_BIT) << "bit" << std::endl - << std::endl; + << "Pointers: " << (sizeof(void*) * CHAR_BIT) << "bit\n" + << "\n"; + + PHYSFS_Version physfs_version; + + // Determine PhysicsFS compile time version + PHYSFS_VERSION(&physfs_version) + writePhysFSVersion(os << "Compiled against PhysicsFS version: ", physfs_version) << "\n"; + + // Determine PhysicsFS runtime version + PHYSFS_getLinkedVersion(&physfs_version); + writePhysFSVersion(os << "Running with PhysicsFS version: ", physfs_version) << "\n" + << "\n"; dbgHeader = strdup(os.str().c_str()); if (dbgHeader == NULL)