diff options
author | David Schulz <david.schulz@qt.io> | 2023-06-06 09:34:24 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2023-06-06 10:55:06 +0000 |
commit | d617b046c6d2405f2adddbfb0381fc2dc9ee4060 (patch) | |
tree | 04e1c07ac448918f1a0b9680400427c797cf5e42 | |
parent | beaf86f9deb219565da0c1b92e727d3138cf6526 (diff) |
Python: support remote file paths when loading projects
Change-Id: I94f709275d3b226685439ac55d58b029d3323d12
Reviewed-by: hjk <hjk@qt.io>
-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. |