Skip to content

Commit f7b6333

Browse files
committed
create missing cache directory before save
1 parent ec89453 commit f7b6333

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/tools/save-load.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include <QByteArray>
33
#include <QFile>
44

5+
#include <libgen.h>
6+
57
#include "../tools.h"
68

79
#ifdef LIBARCHIVE
@@ -93,6 +95,11 @@ void setupSaveLoad(){
9395

9496

9597
bool saveImageToFile(const QImage &image, const QString &imageFilePath) {
98+
QDir dir;
99+
char* fname = strdup(imageFilePath.toStdString().c_str());
100+
char* basedir = dirname(fname);
101+
dir.mkpath(QString::fromUtf8(basedir));
102+
free(fname);
96103
if (image.isNull()) {
97104
return false;
98105
}

0 commit comments

Comments
 (0)