forked from qt-creator/qt-creator
QmlProjectManager: Respect import paths when checking the uri
When checking if an uri in a qmldir file is valid, the cmake generator did not take the importPaths given in the qmlproject into account. This is now fixed. Change-Id: I403665f0c9c57bd41f644cd7c7e19349820b1824 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -224,10 +224,20 @@ bool CMakeGenerator::ignore(const Utils::FilePath &path) const
|
|||||||
|
|
||||||
bool CMakeGenerator::checkUri(const QString& uri, const Utils::FilePath &path) const
|
bool CMakeGenerator::checkUri(const QString& uri, const Utils::FilePath &path) const
|
||||||
{
|
{
|
||||||
Utils::FilePath relative = path.relativeChildPath(m_root->dir);
|
QTC_ASSERT(buildSystem(), return false);
|
||||||
const QList<QStringView> pathComponents = relative.pathView().split('/', Qt::SkipEmptyParts);
|
|
||||||
const QStringList uriComponents = uri.split('.', Qt::SkipEmptyParts);
|
|
||||||
|
|
||||||
|
Utils::FilePath relative = path.relativeChildPath(m_root->dir);
|
||||||
|
QList<QStringView> pathComponents = relative.pathView().split('/', Qt::SkipEmptyParts);
|
||||||
|
|
||||||
|
for (const auto& import : buildSystem()->importPaths()) {
|
||||||
|
Utils::FilePath importPath = Utils::FilePath::fromUserInput(import);
|
||||||
|
for (const auto& component : importPath.pathView().split('/', Qt::SkipEmptyParts)) {
|
||||||
|
if (component == pathComponents.first())
|
||||||
|
pathComponents.pop_front();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const QStringList uriComponents = uri.split('.', Qt::SkipEmptyParts);
|
||||||
if (pathComponents.size() == uriComponents.size()) {
|
if (pathComponents.size() == uriComponents.size()) {
|
||||||
for (qsizetype i=0; i<pathComponents.size(); ++i) {
|
for (qsizetype i=0; i<pathComponents.size(); ++i) {
|
||||||
if (pathComponents[i] != uriComponents[i])
|
if (pathComponents[i] != uriComponents[i])
|
||||||
|
Reference in New Issue
Block a user