summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2017-05-02 12:36:04 +0200
committerTobias Hunger <tobias.hunger@qt.io>2017-05-05 12:06:26 +0000
commitec0ff0cf7cd7e4fa73cb1b1551b245895886d2a8 (patch)
treed72d77320b38f81e74d9b61fa61601e9ff31aa5b
parentae1ae27be33f525c0a69d926106f3eae6a55869a (diff)
downloadqt-creator-ec0ff0cf7cd7e4fa73cb1b1551b245895886d2a8.tar.gz
qmake: Make resource file contents available again
The Qml code model needs the contents of resource files. This was done using QmakeVfs::readVirtualFile, which is not correct, since it does not read data from files on disk. So fix this mistake by using QmakeVfs::readFile instead. Task-number: QTCREATORBUG-18140 Change-Id: I25fd07d63ab02764bdf3fa705e2ff025d6831581 Reviewed-by: Marco Benelli <marco.benelli@qt.io>
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp8
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.cpp5
2 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp b/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
index 0e66a71674..34a52ddc82 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
@@ -162,14 +162,14 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node)
for (const FileName &file : newFilePaths) {
auto vfs = pri->project()->qmakeVfs();
QString contents;
+ QString errorMessage;
// Prefer the cumulative file if it's non-empty, based on the assumption
// that it contains more "stuff".
- vfs->readVirtualFile(file.toString(), QMakeVfs::VfsCumulative, &contents);
+ vfs->readFile(file.toString(), QMakeVfs::VfsCumulative, &contents, &errorMessage);
// If the cumulative evaluation botched the file too much, try the exact one.
if (contents.isEmpty())
- vfs->readVirtualFile(file.toString(), QMakeVfs::VfsExact, &contents);
- auto resourceNode
- = new ResourceEditor::ResourceTopLevelNode(file, false, contents, vfolder);
+ vfs->readFile(file.toString(), QMakeVfs::VfsExact, &contents, &errorMessage);
+ auto resourceNode = new ResourceEditor::ResourceTopLevelNode(file, false, contents, vfolder);
vfolder->addNode(resourceNode);
}
} else {
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
index b335fc2484..abedb87403 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
@@ -358,14 +358,15 @@ void QmakeProject::updateQmlJSCodeModel()
projectInfo.activeResourceFiles.append(exactResources);
projectInfo.allResourceFiles.append(exactResources);
projectInfo.allResourceFiles.append(cumulativeResources);
+ QString errorMessage;
foreach (const QString &rc, exactResources) {
QString contents;
- if (m_qmakeVfs->readVirtualFile(rc, QMakeVfs::VfsExact, &contents))
+ if (m_qmakeVfs->readFile(rc, QMakeVfs::VfsExact, &contents, &errorMessage) == QMakeVfs::ReadOk)
projectInfo.resourceFileContents[rc] = contents;
}
foreach (const QString &rc, cumulativeResources) {
QString contents;
- if (m_qmakeVfs->readVirtualFile(rc, QMakeVfs::VfsCumulative, &contents))
+ if (m_qmakeVfs->readFile(rc, QMakeVfs::VfsCumulative, &contents, &errorMessage) == QMakeVfs::ReadOk)
projectInfo.resourceFileContents[rc] = contents;
}
if (!hasQmlLib) {