From 4e549d123eaf574b96483943931a1fe1d443e623 Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Tue, 10 Oct 2023 19:03:33 -0400 Subject: [PATCH] misc: use the cache dir instead of the data dir as the cache dir Gitlab: #1378 Change-Id: I0249a87fba240eb65165fc79bdbc0ffb55f00af8 --- src/app/utilsadapter.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/app/utilsadapter.cpp b/src/app/utilsadapter.cpp index 386a09d80..5926ae00c 100644 --- a/src/app/utilsadapter.cpp +++ b/src/app/utilsadapter.cpp @@ -154,9 +154,18 @@ UtilsAdapter::getLocalDataPath() const QString UtilsAdapter::getCachePath() { - QDir dataDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); - dataDir.cdUp(); - return dataDir.absolutePath() + "/jami"; + const auto cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); + + // Remove old mistaken cache dir. + // NOTE: this can be removed once we give a chance for users to upgrade. + QDir oldCacheDir(cacheDir); + oldCacheDir.cdUp(); + oldCacheDir.setPath(oldCacheDir.absolutePath() + "/jami"); + if (oldCacheDir.exists()) { + oldCacheDir.removeRecursively(); + } + + return cacheDir; } QString -- GitLab