X-Git-Url: http://rtime.felk.cvut.cz/gitweb/notmuch.git/blobdiff_plain/3b36898f0b5cc03d8d93e2892959aacc8953fc2c..6c9721a40700394e4953e26a8191bbb9552ba145:/notmuch-config.c diff --git a/notmuch-config.c b/notmuch-config.c index 8d286538..88831e27 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -217,9 +217,10 @@ 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: From /etc/passwd + * user_name: $NAME variable if set, otherwise + * read from /etc/passwd * * user_primary_mail: $EMAIL variable if set, otherwise * constructed from the username and @@ -322,14 +323,18 @@ 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_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 = get_name_from_passwd_file (config); + char *name = getenv ("NAME"); + if (! name) + name = get_name_from_passwd_file (config); notmuch_config_set_user_name (config, name); talloc_free (name); } @@ -454,7 +459,7 @@ notmuch_config_save (notmuch_config_t *config) } /* Try not to overwrite symlinks. */ - filename = realpath (config->filename, NULL); + filename = canonicalize_file_name (config->filename); if (! filename) { if (errno == ENOENT) { filename = strdup (config->filename);