From f6d815922d66c4239c8158d00fe9bfeecf4f4b6e Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Fri, 31 May 2019 19:46:24 +0900 Subject: [PATCH] Fix build without feature.temporaryfile Change-Id: I096b6a7d9cc8e17165e07657f6647a14baafefa5 Reviewed-by: Volker Hilsheimer --- src/gui/opengl/qopenglprogrambinarycache.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp index c96021a969..74b91086ee 100644 --- a/src/gui/opengl/qopenglprogrambinarycache.cpp +++ b/src/gui/opengl/qopenglprogrambinarycache.cpp @@ -398,10 +398,16 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId) writeUInt(&blobFormatPtr, blobFormat); +#if QT_CONFIG(temporaryfile) QSaveFile f(cacheFileName(cacheKey)); if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { f.write(blob); if (!f.commit()) +#else + QFile f(cacheFileName(cacheKey)); + if (f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { + if (f.write(blob) < blob.length()) +#endif qCDebug(DBG_SHADER_CACHE, "Failed to write %s to shader cache", qPrintable(f.fileName())); } else { qCDebug(DBG_SHADER_CACHE, "Failed to create %s in shader cache", qPrintable(f.fileName()));