Commit bd3f39a3 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

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's avatarTobias Hunger <tobias.hunger@qt.io>
parent 7754606b
...@@ -271,6 +271,7 @@ QrcParserPrivate::QrcParserPrivate(QrcParser *) ...@@ -271,6 +271,7 @@ QrcParserPrivate::QrcParserPrivate(QrcParser *)
bool QrcParserPrivate::parseFile(const QString &path) bool QrcParserPrivate::parseFile(const QString &path)
{ {
QDir baseDir(QFileInfo(path).path());
QFile file(path); QFile file(path);
if (!file.open(QIODevice::ReadOnly)) { if (!file.open(QIODevice::ReadOnly)) {
m_errorMessages.append(file.errorString()); m_errorMessages.append(file.errorString());
...@@ -304,9 +305,8 @@ bool QrcParserPrivate::parseFile(const QString &path) ...@@ -304,9 +305,8 @@ bool QrcParserPrivate::parseFile(const QString &path)
QDomElement felt = relt.firstChildElement(QLatin1String("file")); QDomElement felt = relt.firstChildElement(QLatin1String("file"));
for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) { for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) {
const QString fileName = felt.text(); const QString fileName = felt.text();
QTC_CHECK(!QDir::isAbsolutePath(fileName));
const QString alias = felt.attribute(QLatin1String("alias")); const QString alias = felt.attribute(QLatin1String("alias"));
QString filePath = QFileInfo(path).path() + QLatin1Char('/') + fileName; QString filePath = baseDir.absoluteFilePath(fileName);
QString accessPath; QString accessPath;
if (!alias.isEmpty()) if (!alias.isEmpty())
accessPath = language + prefix + alias; accessPath = language + prefix + alias;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment