diff options
Diffstat (limited to 'lib/util.cpp')
-rw-r--r-- | lib/util.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/util.cpp b/lib/util.cpp index 1773fcfe..af06013c 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -19,6 +19,9 @@ #include "util.h" #include <QtCore/QRegularExpression> +#include <QtCore/QStandardPaths> +#include <QtCore/QDir> +#include <QtCore/QStringBuilder> static const auto RegExpOptions = QRegularExpression::CaseInsensitiveOption @@ -61,3 +64,14 @@ QString QMatrixClient::prettyPrint(const QString& plainText) linkifyUrls(pt); return pt; } + +QString QMatrixClient::cacheLocation(const QString& dirName) +{ + const QString cachePath = + QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + % '/' % dirName % '/'; + QDir dir; + if (!dir.exists(cachePath)) + dir.mkpath(cachePath); + return cachePath; +} |