summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPekka Vuorela <pvuorela@iki.fi>2025-11-14 08:35:26 +0200
committerPekka Vuorela <pvuorela@iki.fi>2025-11-14 12:32:49 +0200
commit4d64d0632bbfc4ff8df1e74e590eb90e25ae710a (patch)
tree7602f2c28f907e59ec30f4f3ace1474b08740f3e
parent574b95848431529e783b7c6c72f557c4b6dbfc7c (diff)
Make QMail::dataPath() path selection more robust
E.g. on sandboxing case the new path might exist as empty just to get access to it. Try here to ensure better that the selected path is actually already in use. Change-Id: I6c2449bcf9b1508ce01b0f83ea60e051b71d211c Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi> Reviewed-by: <matti.viljanen@kapsi.fi>
-rw-r--r--src/libraries/qmfclient/support/qmailnamespace.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libraries/qmfclient/support/qmailnamespace.cpp b/src/libraries/qmfclient/support/qmailnamespace.cpp
index 08a30e23..8efa64b6 100644
--- a/src/libraries/qmfclient/support/qmailnamespace.cpp
+++ b/src/libraries/qmfclient/support/qmailnamespace.cpp
@@ -105,12 +105,13 @@ QString QMail::dataPath()
QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/qmf/";
- if (QDir(path).exists()) {
+ // path checks made with db subdirectory to check it's actually in use
+ if (QDir(path + QLatin1String("database")).exists()) {
cached = path;
} else {
// for backwards compatibility return the older data path if it exists and the new doesn't
QString oldPath = QDir::homePath() + QLatin1String("/.qmf/");
- cached = QDir(oldPath).exists() ? oldPath : path;
+ cached = QDir(oldPath + QLatin1String("database")).exists() ? oldPath : path;
}
return cached;