Create screenshots folder if it doesn't exist

This commit is contained in:
Tobias Fella
2022-10-24 16:39:53 +02:00
parent 659f10c71a
commit 0b9b3e3496

View File

@@ -33,6 +33,9 @@ QImage Clipboard::image() const
QString Clipboard::saveImage(QString localPath) const
{
if (!QDir().exists(QStringLiteral("%1/screenshots").arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)))) {
QDir().mkdir(QStringLiteral("%1/screenshots").arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)));
}
if (localPath.isEmpty()) {
localPath = QStringLiteral("file://%1/screenshots/%2.png")
.arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation),