QDoc: Check if index file was already inserted in list.
Previously it was possible to insert exactly the same index file in the map twice by specifying an -indexdir which is the same as -installdir. Probably you can also have two indexes with the same name that happen to have the same creation time, but changes of that happening are slim to none. Change-Id: I6be5fb9d04839026830b9948887b282489b379c0 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
This commit is contained in:
parent
8a5af08cf0
commit
5bbe8756fd
@ -94,6 +94,11 @@ static const struct {
|
|||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool creationTimeBefore(const QFileInfo &fi1, const QFileInfo &fi2)
|
||||||
|
{
|
||||||
|
return fi1.lastModified() < fi2.lastModified();
|
||||||
|
}
|
||||||
|
|
||||||
static bool highlighting = false;
|
static bool highlighting = false;
|
||||||
static bool showInternal = false;
|
static bool showInternal = false;
|
||||||
static bool obsoleteLinks = false;
|
static bool obsoleteLinks = false;
|
||||||
@ -280,30 +285,32 @@ static void processQdocconfFile(const QString &fileName)
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < dependModules.size(); i++) {
|
for (int i = 0; i < dependModules.size(); i++) {
|
||||||
QString indexToAdd;
|
QString indexToAdd;
|
||||||
QMultiMap<uint, QFileInfo> foundIndices;
|
QList<QFileInfo> foundIndices;
|
||||||
for (int j = 0; j < indexDirs.size(); j++) {
|
for (int j = 0; j < indexDirs.size(); j++) {
|
||||||
QString fileToLookFor = indexDirs[j] + QLatin1Char('/') + dependModules[i] +
|
QString fileToLookFor = indexDirs[j] + QLatin1Char('/') + dependModules[i] +
|
||||||
QLatin1Char('/') + dependModules[i] + QLatin1String(".index");
|
QLatin1Char('/') + dependModules[i] + QLatin1String(".index");
|
||||||
if (QFile::exists(fileToLookFor)) {
|
if (QFile::exists(fileToLookFor)) {
|
||||||
QFileInfo tempFileInfo(fileToLookFor);
|
QFileInfo tempFileInfo(fileToLookFor);
|
||||||
foundIndices.insert(tempFileInfo.lastModified().toTime_t(), tempFileInfo);
|
if (!foundIndices.contains(tempFileInfo))
|
||||||
|
foundIndices.append(tempFileInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
qSort(foundIndices.begin(), foundIndices.end(), creationTimeBefore);
|
||||||
if (foundIndices.size() > 1) {
|
if (foundIndices.size() > 1) {
|
||||||
/*
|
/*
|
||||||
QDoc should always use the last entry in the multimap when there are
|
QDoc should always use the last entry in the multimap when there are
|
||||||
multiple index files for a module, since the last modified file has the
|
multiple index files for a module, since the last modified file has the
|
||||||
highest UNIX timestamp.
|
highest UNIX timestamp.
|
||||||
*/
|
*/
|
||||||
qDebug() << "Multiple indices found for dependency:" << dependModules[i];
|
qDebug() << "Multiple indices found for dependency:" << dependModules[i] << "\nFound:";
|
||||||
qDebug() << "Using" << foundIndices.value(
|
for (int k = 0; k < foundIndices.size(); k++)
|
||||||
foundIndices.keys()[foundIndices.size() - 1]).absoluteFilePath()
|
qDebug() << foundIndices[k].absoluteFilePath();
|
||||||
|
qDebug() << "Using" << foundIndices[foundIndices.size() - 1].absoluteFilePath()
|
||||||
<< "as index for" << dependModules[i];
|
<< "as index for" << dependModules[i];
|
||||||
indexToAdd = foundIndices.value(
|
indexToAdd = foundIndices[foundIndices.size() - 1].absoluteFilePath();
|
||||||
foundIndices.keys()[foundIndices.size() - 1]).absoluteFilePath();
|
|
||||||
}
|
}
|
||||||
else if (foundIndices.size() == 1) {
|
else if (foundIndices.size() == 1) {
|
||||||
indexToAdd = foundIndices.value(foundIndices.keys()[0]).absoluteFilePath();
|
indexToAdd = foundIndices[0].absoluteFilePath();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qDebug() << "No indices for" << dependModules[i] <<
|
qDebug() << "No indices for" << dependModules[i] <<
|
||||||
|
Loading…
x
Reference in New Issue
Block a user