diff options
-rw-r--r-- | src/plugins/python/pythonproject.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/python/pythonproject.cpp b/src/plugins/python/pythonproject.cpp index 86afde46e8..e9d503037d 100644 --- a/src/plugins/python/pythonproject.cpp +++ b/src/plugins/python/pythonproject.cpp @@ -90,14 +90,13 @@ private: static QJsonObject readObjJson(const FilePath &projectFile, QString *errorMessage) { - QFile file(projectFile.toString()); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - *errorMessage = Tr::tr("Unable to open \"%1\" for reading: %2") - .arg(projectFile.toUserOutput(), file.errorString()); - return QJsonObject(); + const expected_str<QByteArray> fileContentsResult = projectFile.fileContents(); + if (!fileContentsResult) { + *errorMessage = fileContentsResult.error(); + return {}; } - const QByteArray content = file.readAll(); + const QByteArray content = *fileContentsResult; // This assumes the project file is formed with only one field called // 'files' that has a list associated of the files to include in the project. |