forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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)
|
|||||||
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;
|
||||||
|
Reference in New Issue
Block a user