diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/divepicturewidget.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/qt-ui/divepicturewidget.cpp b/qt-ui/divepicturewidget.cpp index 0bf3424bc..ce997fea1 100644 --- a/qt-ui/divepicturewidget.cpp +++ b/qt-ui/divepicturewidget.cpp @@ -65,7 +65,11 @@ void ImageDownloader::saveImage(QNetworkReply *reply) QByteArray imageData = reply->readAll(); QCryptographicHash hash(QCryptographicHash::Sha1); hash.addData(imageData); - QFile imageFile(QStandardPaths::standardLocations(QStandardPaths::CacheLocation).first().append("/").append(hash.result().toHex())); + QString path = QStandardPaths::standardLocations(QStandardPaths::CacheLocation).first(); + QDir dir(path); + if (!dir.exists()) + dir.mkpath(path); + QFile imageFile(path.append("/").append(hash.result().toHex())); if (imageFile.open(QIODevice::WriteOnly)) { QDataStream stream(&imageFile); stream.writeRawData(imageData.data(), imageData.length()); |