From bd3f39a3589458c02970e635e7bbf6aa0f2a53ba Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Date: Fri, 21 Oct 2016 12:19:47 +0200
Subject: [PATCH] accept absolute paths in qrc file elements

while untypical, it's perfectly legitimate to have absolute paths in qrc
files. auto-generated files (like the ones created by resources.prf when
shadow-building) can make good use of them.

Change-Id: I59da260b5241096f7c44b9de5ee04f65e8c1218c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
---
 src/libs/qmljs/qmljsqrcparser.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libs/qmljs/qmljsqrcparser.cpp b/src/libs/qmljs/qmljsqrcparser.cpp
index dd9d0892905..d4e0d2c40ff 100644
--- a/src/libs/qmljs/qmljsqrcparser.cpp
+++ b/src/libs/qmljs/qmljsqrcparser.cpp
@@ -271,6 +271,7 @@ QrcParserPrivate::QrcParserPrivate(QrcParser *)
 
 bool QrcParserPrivate::parseFile(const QString &path)
 {
+    QDir baseDir(QFileInfo(path).path());
     QFile file(path);
     if (!file.open(QIODevice::ReadOnly)) {
         m_errorMessages.append(file.errorString());
@@ -304,9 +305,8 @@ bool QrcParserPrivate::parseFile(const QString &path)
         QDomElement felt = relt.firstChildElement(QLatin1String("file"));
         for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) {
             const QString fileName = felt.text();
-            QTC_CHECK(!QDir::isAbsolutePath(fileName));
             const QString alias = felt.attribute(QLatin1String("alias"));
-            QString filePath = QFileInfo(path).path() + QLatin1Char('/') + fileName;
+            QString filePath = baseDir.absoluteFilePath(fileName);
             QString accessPath;
             if (!alias.isEmpty())
                 accessPath = language + prefix + alias;
-- 
GitLab