Details
-
User Story
-
Resolution: Done
-
Not Evaluated
-
None
-
None
-
None
-
QDS Berlin - 2024 Week 43/44
-
f13a1c682 (qds/dev), 811c8db63 (qds/dev)
Description
Ensure that components from the qmldir actually exist.
ProjectStorageUpdater::Components createComponents(
const QMultiHash<QString, QmlDirParser::Component> &qmlDirParserComponents,
ModuleId moduleId,
ModuleId pathModuleId,
FileSystemInterface &fileSystem,
const Utils::PathString &directory)
{
qDebug() << Q_FUNC_INFO << directory.toQString();
ProjectStorageUpdater::Components components;
auto qmlFileNames = fileSystem.qmlFileNames(QString
{directory});
qDebug() << Q_FUNC_INFO << "qmlFileNames" << qmlFileNames;
components.reserve(static_cast<std::size_t>(qmlDirParserComponents.size() + qmlFileNames.size()));
for (const QString &qmlFileName : qmlFileNames) {
Utils::PathString fileName
;
Utils::PathString typeName
;
components.push_back(
ProjectStorageUpdater::Component
);
}
for (const QmlDirParser::Component &qmlDirParserComponent : qmlDirParserComponents) {
if (qmlDirParserComponent.fileName.contains('/'))
continue;
qDebug() << Q_FUNC_INFO << "qmldir" << qmlDirParserComponent.fileName << qmlDirParserComponent.typeName;
components.push_back(ProjectStorageUpdater::Component
);
}
return components;
}
On Windows for some reason the qmldir even includes the module name as a component.
In any case we should check if a file (qmlDirParserComponent.fileName), does actually exist before pushing it.
A missing file should trigger a warning.
Pushing the component here, if it does not exist, will trigger an unhandled exception down the road. This should be handled here.
Attachments
For Gerrit Dashboard: QDS-13954 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
600509,2 | QmlDesigner: Ignore component wit non existing files | qds/dev | qt-creator/qt-creator | Status: MERGED | +2 | +1 |
600635,2 | QmlDesigner: Add dummy types if qml document don't exists | qds/dev | qt-creator/qt-creator | Status: MERGED | +2 | +1 |