summaryrefslogtreecommitdiffstats
path: root/src/plugins/sceneparsers/gltf/gltfparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/sceneparsers/gltf/gltfparser.cpp')
-rw-r--r--src/plugins/sceneparsers/gltf/gltfparser.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/plugins/sceneparsers/gltf/gltfparser.cpp b/src/plugins/sceneparsers/gltf/gltfparser.cpp
index 6bfca2b55..e42ebb510 100644
--- a/src/plugins/sceneparsers/gltf/gltfparser.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfparser.cpp
@@ -196,13 +196,11 @@ bool GLTFParser::setJSON(const QJsonDocument &json )
void GLTFParser::setSource(const QUrl &source)
{
const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
- QFileInfo finfo(path);
- if (!finfo.exists()) {
- qCWarning(GLTFParserLog) << "missing file:" << path;
+ QFile f(path);
+ if (Q_UNLIKELY(!f.open(QIODevice::ReadOnly))) {
+ qCWarning(GLTFParserLog) << "cannot open " << path << ": " << f.errorString();
return;
}
- QFile f(path);
- f.open(QIODevice::ReadOnly);
QByteArray jsonData = f.readAll();
QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(jsonData);
@@ -214,7 +212,7 @@ void GLTFParser::setSource(const QUrl &source)
return;
}
- setBasePath(finfo.dir().absolutePath());
+ setBasePath(QFileInfo(path).dir().absolutePath());
}
/*!