From 70ec403a552935e2f05ce80fbc5b7e9c83a7d3be Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 21 Nov 2024 20:37:37 +0100 Subject: [PATCH] Ensure directory is created Fix #424 --- quicksettings/record/recordutil.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/quicksettings/record/recordutil.cpp b/quicksettings/record/recordutil.cpp index e1a9e491..e8a1cb08 100644 --- a/quicksettings/record/recordutil.cpp +++ b/quicksettings/record/recordutil.cpp @@ -6,12 +6,15 @@ #include "recordutil.h" +#include #include #include #include #include +using namespace Qt::StringLiterals; + RecordUtil::RecordUtil(QObject *parent) : QObject{parent} { @@ -19,7 +22,10 @@ RecordUtil::RecordUtil(QObject *parent) QString RecordUtil::videoLocation(const QString &name) { - QString path = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation); + const QString path = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation); + if (!QDir(path).mkpath(u"."_s)) { + qWarning() << "Unable to create directory" << path; + } QString newPath(path + '/' + name); if (QFile::exists(newPath)) { newPath = path + '/' + KFileUtils::suggestName(QUrl::fromLocalFile(newPath), name);