added svn revision number to version string (commands <-v> and <-V>, startup log entry); svn revision is automatically read from svn-repository on each build

This commit is contained in:
Andrey Prygunkov
2009-04-17 21:53:00 +00:00
parent 18d3e0db42
commit c8e7cc856f
8 changed files with 125 additions and 12 deletions

View File

@@ -47,6 +47,11 @@
#include "nzbget.h"
#include "Util.h"
#ifndef WIN32
// function "svn_version" is automatically generated in file "svn_version.cpp" on each build
const char* svn_version(void);
#endif
#ifdef WIN32
// getopt for WIN32:
@@ -199,6 +204,8 @@ const char* DirBrowser::Next()
#endif
char Util::VersionRevisionBuf[40];
char* Util::BaseFileName(const char* filename)
{
char* p = (char*)strrchr(filename, PATH_SEPARATOR);
@@ -1131,3 +1138,17 @@ void Util::FormatFileSize(char * szBuffer, int iBufLen, long long lFileSize)
}
szBuffer[iBufLen - 1] = '\0';
}
void Util::InitVersionRevision()
{
#ifndef WIN32
if ((strlen(svn_version()) > 0) && strstr(VERSION, "testing"))
{
snprintf(VersionRevisionBuf, sizeof(VersionRevisionBuf), "%s-r%s", VERSION, svn_version());
}
else
#endif
{
snprintf(VersionRevisionBuf, sizeof(VersionRevisionBuf), "%s", VERSION);
}
}