CoverUtils: Only create path if it doesn't exist

This commit is contained in:
Jonas Kvinge
2023-06-15 21:04:11 +02:00
parent 950c236720
commit b87a950357

View File

@@ -21,6 +21,7 @@
#include <QString> #include <QString>
#include <QRegularExpression> #include <QRegularExpression>
#include <QUrl> #include <QUrl>
#include <QFileInfo>
#include <QDir> #include <QDir>
#include <QStandardPaths> #include <QStandardPaths>
#include <QCryptographicHash> #include <QCryptographicHash>
@@ -80,7 +81,7 @@ QString CoverUtils::CoverFilePath(const CoverOptions &options, const Song::Sourc
} }
QDir dir; QDir dir;
if (!dir.mkpath(path)) { if (!QFileInfo::exists(path) && !dir.mkpath(path)) {
qLog(Error) << "Unable to create directory" << path; qLog(Error) << "Unable to create directory" << path;
path = QStandardPaths::writableLocation(QStandardPaths::TempLocation); path = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
} }