X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fopen.cc;h=137434592a3066a6d69d83ee2a365fd9a4095ebb;hb=d9300116909ea316c84fd6d3ee57c89074dcd260;hp=1e9c86fee1e0542a37796879e1bf53b6bc9fa5e3;hpb=393c92b04271472e6fdd19da73672a60723e34aa;p=notmuch diff --git a/lib/open.cc b/lib/open.cc index 1e9c86fe..13743459 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -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) {