]> git.notmuchmail.org Git - notmuch/blobdiff - lib/open.cc
lib/open: look in MAILDIR for database, as documented.
[notmuch] / lib / open.cc
index 1e9c86fee1e0542a37796879e1bf53b6bc9fa5e3..137434592a3066a6d69d83ee2a365fd9a4095ebb 100644 (file)
@@ -209,8 +209,29 @@ _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) {
+       *database_path = getenv ("MAILDIR");
+    }
+
+    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) {