summaryrefslogtreecommitdiffstats
path: root/src/linguist/shared/qmakeparser.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-10-28 20:10:40 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-09-14 13:50:13 +0000
commit7eefa1f07bbe5a2482d1d936a190c9b9e9eea4f0 (patch)
treefd77c0c365ff2d5d10b69e098a09c3e56b624a3b /src/linguist/shared/qmakeparser.cpp
parent3fc48e19ac8f63eb578921cdf0905fad625427dc (diff)
qmake: let QMakeVfs::readFile() report ENOFILE explicitly
when the QFile object is already constructed, querying whether the file exists is actually cheap, so do it right away instead of later on demand. that makes the calling code a bit cleaner. fwiw, that we need to explicitly query the file's existence at all is a result of QFile's completely useless error "codes" (which merely say which function failed, as if the caller would not know). Change-Id: Ifec39d05b1713d8128046f679287e510f10e45dc Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from qtcreator/5ba32e3484ead2e35cc7732dcd59a97e7459dbfd) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/linguist/shared/qmakeparser.cpp')
-rw-r--r--src/linguist/shared/qmakeparser.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/linguist/shared/qmakeparser.cpp b/src/linguist/shared/qmakeparser.cpp
index ea6377e07..572957ab9 100644
--- a/src/linguist/shared/qmakeparser.cpp
+++ b/src/linguist/shared/qmakeparser.cpp
@@ -254,8 +254,9 @@ bool QMakeParser::read(ProFile *pro, ParseFlags flags)
{
QString content;
QString errStr;
- if (!m_vfs->readFile(pro->fileName(), &content, &errStr)) {
- if (m_handler && ((flags & ParseReportMissing) || m_vfs->exists(pro->fileName())))
+ QMakeVfs::ReadResult result = m_vfs->readFile(pro->fileName(), &content, &errStr);
+ if (result != QMakeVfs::ReadOk) {
+ if (m_handler && ((flags & ParseReportMissing) || result != QMakeVfs::ReadNotFound))
m_handler->message(QMakeParserHandler::ParserIoError,
fL1S("Cannot read %1: %2").arg(pro->fileName(), errStr));
return false;