forked from qt-creator/qt-creator
Remove stale entries in assistant db blocking qch file registering
registerDocumentation failed if a namespace/qch file had been registered before, but the qch file is not accessible any more. This prevented the registration of the same namespace/qch file at a different location. Fix this by explicitly removing entries that have no valid qch file any more from the db. Reviewed-by: con
This commit is contained in:
@@ -105,12 +105,23 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
|
|||||||
if (!QFileInfo(fileName).exists())
|
if (!QFileInfo(fileName).exists())
|
||||||
continue;
|
continue;
|
||||||
const QString &nameSpace = QHelpEngineCore::namespaceName(fileName);
|
const QString &nameSpace = QHelpEngineCore::namespaceName(fileName);
|
||||||
if (!nameSpace.isEmpty()
|
if (!nameSpace.isEmpty()) {
|
||||||
&& !hc.registeredDocumentations().contains(nameSpace)) {
|
if (hc.registeredDocumentations().contains(nameSpace)) {
|
||||||
if (hc.registerDocumentation(fileName))
|
if (!QFileInfo(hc.documentationFileName(nameSpace)).exists()) {
|
||||||
|
// remove stale documentation path first
|
||||||
|
if (!hc.unregisterDocumentation(fileName)) {
|
||||||
|
qWarning() << "error unregistering " << fileName << hc.error();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hc.registerDocumentation(fileName)) {
|
||||||
needsSetup = true;
|
needsSetup = true;
|
||||||
else
|
} else {
|
||||||
qDebug() << "error registering" << fileName << hc.error();
|
qWarning() << "error registering" << fileName << hc.error();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user