summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-05-10 07:39:18 -0300
committerDavid Bremner <david@tethera.net>2021-05-15 08:40:05 -0300
commitb3258244c84a7673db39c46cad96ddb63b131dae (patch)
tree404daa0604888bcd7c5063fa83fecbdcf4bf0de0 /lib
parent0e8795b28c809861e81dd50653a5355333cbcd59 (diff)
lib/open: restore default database path of $HOME/mail
Although this default worked for "notmuch config get", it didn't work most other places. Restore the previous functionality, with the wrinkle that XDG locations will shadow $HOME/mail if they exist. This fixes a bug reported by Jack Kamm in id:87eeefdc8b.fsf@gmail.com
Diffstat (limited to 'lib')
-rw-r--r--lib/open.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/open.cc b/lib/open.cc
index 1e9c86fe..3325e725 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) {