Pick up the newest debugging helper from the possible locations.

Otherwise "rebuilding" the debugging helper doesn't necessarily lead to
Qt Creator picking up the new one (some of the locations can be
read-only).

Reviewed-by: dt
This commit is contained in:
con
2010-07-05 13:22:46 +02:00
parent 4111d8a01d
commit 4245b4ab44

View File

@@ -116,20 +116,25 @@ QString DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(const QStrin
if (!Core::ICore::instance())
return QString();
const QString dumperSourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/gdbmacros/");
QDateTime lastModified = QFileInfo(dumperSourcePath + "gdbmacros.cpp").lastModified();
QDateTime sourcesModified = QFileInfo(dumperSourcePath + "gdbmacros.cpp").lastModified();
// We pretend that the lastmodified of gdbmacros.cpp is 5 minutes before what the file system says
// Because afer a installation from the package the modified dates of gdbmacros.cpp
// and the actual library are close to each other, but not deterministic in one direction
lastModified = lastModified.addSecs(-300);
sourcesModified = sourcesModified.addSecs(-300);
// look for the newest helper library in the different locations
QString newestHelper;
QDateTime newestHelperModified = sourcesModified; // prevent using one that's older than the sources
QFileInfo fileInfo;
foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData)) {
if (getHelperFileInfoFor(directory, &fileInfo)) {
if (fileInfo.lastModified() >= lastModified)
return fileInfo.filePath();
if (fileInfo.lastModified() > newestHelperModified) {
newestHelper = fileInfo.filePath();
newestHelperModified = fileInfo.lastModified();
}
}
}
return QString();
return newestHelper;
}
// Copy helper source files to a target directory, replacing older files.