X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fgenversion.cpp;h=904e9718415f991b6b52829d9b2df4c0fa66cb18;hb=745f33ace5377addd6fec7991db594dd8c64984d;hp=3a552f3d1fd89f2cb3d6a7eda2a2e601cdef64fd;hpb=480eab8daec4fb56a6886918c6a913cc197330f1;p=quassel.git diff --git a/src/common/genversion.cpp b/src/common/genversion.cpp index 3a552f3d..904e9718 100644 --- a/src/common/genversion.cpp +++ b/src/common/genversion.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -100,14 +100,23 @@ int main(int argc, char **argv) { verfile.close(); } - // ok, create our version.gen now + // generate the contents for version.gen + QByteArray contents = QString("QString buildinfo = \"%1,%2,%3,%4,%5,%6,%7,%8\";\n") + .arg(basever, descrver, dirty, committish, commitdate, protover, clientneeds, coreneeds) + .toAscii(); + QFile gen(target); - if(!gen.open(QIODevice::WriteOnly | QIODevice::Text)) { + if(!gen.open(QIODevice::ReadWrite | QIODevice::Text)) { qFatal("%s", qPrintable(QString("Could not write %1!").arg(target))); return EXIT_FAILURE; } - gen.write(QString("QString buildinfo = \"%1,%2,%3,%4,%5,%6,%7,%8\";") - .arg(basever, descrver, dirty, committish, commitdate, protover, clientneeds, coreneeds).toAscii()); + QByteArray oldContents = gen.readAll(); + if(oldContents != contents) { // only touch the file if something changed + gen.seek(0); + gen.write(contents); + gen.waitForBytesWritten(10000); + } gen.close(); + return EXIT_SUCCESS; }