]> git.notmuchmail.org Git - notmuch/commitdiff
config: read database.path from $MAILDIR if set
authorMark Oteiza <mvoteiza@udel.edu>
Mon, 21 Jul 2014 23:05:12 +0000 (19:05 -0400)
committerDavid Bremner <david@tethera.net>
Thu, 31 Jul 2014 10:13:38 +0000 (07:13 -0300)
Try to read the config parameter database.path from $MAILDIR before
falling back to $HOME/mail

notmuch-config.c

index 8f1f48d07b51301a0f08be1a39b7ab6beb3ba7f1..88831e278f9fbf10b2d30eccf81a44a3052bfc26 100644 (file)
@@ -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,8 +323,10 @@ 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);
     }