X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch-config.c;h=db487dbe828ba808b6c3223a8d33df581864d74f;hb=658a00e7c809cc4e3076aab28e105d3761086451;hp=8f1f48d07b51301a0f08be1a39b7ab6beb3ba7f1;hpb=488b2619643de6776e2649d97b480da8db049023;p=notmuch diff --git a/notmuch-config.c b/notmuch-config.c index 8f1f48d0..db487dbe 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -217,7 +217,7 @@ get_username_from_passwd_file (void *ctx) * These default configuration settings are determined as * follows: * - * database_path: $HOME/mail + * database_path: $MAILDIR, otherwise $HOME/mail * * user_name: $NAME variable if set, otherwise * read from /etc/passwd @@ -323,15 +323,21 @@ notmuch_config_open (void *ctx, if (notmuch_config_get_database_path (config) == NULL) { - char *path = talloc_asprintf (config, "%s/mail", - getenv ("HOME")); + char *path = getenv ("MAILDIR"); + if (path) + path = talloc_strdup (config, path); + else + path = talloc_asprintf (config, "%s/mail", + getenv ("HOME")); notmuch_config_set_database_path (config, path); talloc_free (path); } if (notmuch_config_get_user_name (config) == NULL) { char *name = getenv ("NAME"); - if (! name) + if (name) + name = talloc_strdup (config, name); + else name = get_name_from_passwd_file (config); notmuch_config_set_user_name (config, name); talloc_free (name);