From e2de837198884b64345f746ef257e6d83bffa571 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 28 Oct 2016 20:10:40 +0200 Subject: 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 (cherry picked from qtcreator/5ba32e3484ead2e35cc7732dcd59a97e7459dbfd) Reviewed-by: Joerg Bornemann --- qmake/library/qmakevfs.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'qmake/library/qmakevfs.h') diff --git a/qmake/library/qmakevfs.h b/qmake/library/qmakevfs.h index 8677ba08c1..5e6a2f88e2 100644 --- a/qmake/library/qmakevfs.h +++ b/qmake/library/qmakevfs.h @@ -45,10 +45,16 @@ QT_BEGIN_NAMESPACE class QMAKE_EXPORT QMakeVfs { public: + enum ReadResult { + ReadOk, + ReadNotFound, + ReadOtherError + }; + QMakeVfs(); bool writeFile(const QString &fn, QIODevice::OpenMode mode, bool exe, const QString &contents, QString *errStr); - bool readFile(const QString &fn, QString *contents, QString *errStr); + ReadResult readFile(const QString &fn, QString *contents, QString *errStr); bool exists(const QString &fn); #ifndef PROEVALUATOR_FULL -- cgit v1.2.3