aboutsummaryrefslogtreecommitdiff
path: root/lib/open.cc
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-05-15 09:10:58 -0300
committerDavid Bremner <david@tethera.net>2021-05-15 09:10:58 -0300
commitc84ccb70f3ed2b2228346499b5110311039a0ecf (patch)
tree373ab71c8d6799b393dab21a46d4a773fac6ae53 /lib/open.cc
parentccd2ef38718efa3c9268eb68ad54454609e4451c (diff)
parentb580009e2bc69efb019983bf2f7dc5052c19545a (diff)
Merge branch 'release'
Diffstat (limited to 'lib/open.cc')
-rw-r--r--lib/open.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/open.cc b/lib/open.cc
index 84b2d6b1..1ca69665 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -209,8 +209,25 @@ _choose_database_path (void *ctx,
}
}
if (! *database_path) {
+ notmuch_status_t status;
+
*database_path = _xdg_dir (ctx, "XDG_DATA_HOME", ".local/share", profile);
- *split = true;
+ status = _db_dir_exists (*database_path, message);
+ if (status) {
+ *database_path = NULL;
+ } else {
+ *split = true;
+ }
+ }
+
+ if (! *database_path) {
+ notmuch_status_t status;
+
+ *database_path = talloc_asprintf (ctx, "%s/mail", getenv ("HOME"));
+ status = _db_dir_exists (*database_path, message);
+ if (status) {
+ *database_path = NULL;
+ }
}
if (*database_path == NULL) {