Callgrind: Avoid an extra call to QDir::entryList()

Change-Id: I22220ccafe64b2eede3ac7d360b8fabe7ccc2b85
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Orgad Shaneh
2018-11-07 23:46:34 +02:00
committed by Orgad Shaneh
parent c8c642dde0
commit 136e0f69e4

View File

@@ -225,11 +225,11 @@ void CallgrindController::getLocalDataFile()
// this, &CallgrindController::foundRemoteFile);
// m_findRemoteFile->start();
} else {
QDir dir(workingDir, QString::fromLatin1("%1.*").arg(baseFileName), QDir::Time);
QStringList outputFiles = dir.entryList();
const QDir dir(workingDir, QString::fromLatin1("%1.*").arg(baseFileName), QDir::Time);
const QStringList outputFiles = dir.entryList();
// if there are files like callgrind.out.PID.NUM, set it to the most recent one of those
if (!outputFiles.isEmpty())
fileName = workingDir + QLatin1Char('/') + dir.entryList().first();
fileName = workingDir + QLatin1Char('/') + outputFiles.first();
emit localParseDataAvailable(fileName);
}