X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fopen.cc;h=72f1232c1a990399407680779f2204b7f56a8a30;hb=d21e72c9f95d1d052360976302a2f9cfcc1556a5;hp=84b2d6b1e56d70b092b9f9d49f1f676c7f0f84bf;hpb=8410be8e0867820c9814d06b49ff6da822d384a3;p=notmuch diff --git a/lib/open.cc b/lib/open.cc index 84b2d6b1..72f1232c 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) { @@ -225,7 +242,7 @@ _choose_database_path (void *ctx, return NOTMUCH_STATUS_SUCCESS; } -notmuch_database_t * +static notmuch_database_t * _alloc_notmuch () { notmuch_database_t *notmuch; @@ -738,7 +755,7 @@ notmuch_database_reopen (notmuch_database_t *notmuch, return NOTMUCH_STATUS_SUCCESS; } -notmuch_status_t +static notmuch_status_t _maybe_load_config_from_database (notmuch_database_t *notmuch, GKeyFile *key_file, const char *database_path,