X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fopen.cc;h=25691a8ac6df76de11ad024d701d474d393cdae9;hp=0dfd295f2e8b8da1166cd0e3184789ccef5d0510;hb=c82554193d0a0c288ad49e3d4fb8c949b92f71fa;hpb=2c879667b3c9d51eb23f53c040acce341d75920b diff --git a/lib/open.cc b/lib/open.cc index 0dfd295f..25691a8a 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -181,6 +181,7 @@ _choose_database_path (void *ctx, const char *profile, GKeyFile **key_file, const char **database_path, + bool *split, char **message) { notmuch_status_t status; @@ -203,6 +204,11 @@ _choose_database_path (void *ctx, } } + if (! *database_path) { + *database_path = _xdg_dir (ctx, "XDG_DATA_HOME", ".local/share", profile); + *split = true; + } + if (*database_path == NULL) { *message = strdup ("Error: Cannot open a database for a NULL path.\n"); return NOTMUCH_STATUS_NULL_POINTER; @@ -462,6 +468,7 @@ notmuch_database_open_with_config (const char *database_path, notmuch_database_t *notmuch = NULL; char *message = NULL; GKeyFile *key_file = NULL; + bool split = false; _init_libs (); @@ -471,7 +478,8 @@ notmuch_database_open_with_config (const char *database_path, goto DONE; } - if ((status = _choose_database_path (local, config_path, profile, &key_file, &database_path, + if ((status = _choose_database_path (local, config_path, profile, + &key_file, &database_path, &split, &message))) goto DONE; @@ -563,7 +571,8 @@ notmuch_database_create_with_config (const char *database_path, _init_libs (); if ((status = _choose_database_path (local, config_path, profile, - &key_file, &database_path, &message))) + &key_file, &database_path, &split, + &message))) goto DONE; status = _db_dir_exists (database_path, &message);