X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch.c;h=757f09d797b6df0f51bb6b6ef2cc51315884f93e;hp=5a0ca5c946c69e12adadca235969463e98983f91;hb=a1135f0b7e67db7056a4ef02d61b8ad0ec46e88b;hpb=fbf55bfe2fdcdf3773ba37a9921875530e94c7b3 diff --git a/notmuch.c b/notmuch.c index 5a0ca5c9..757f09d7 100644 --- a/notmuch.c +++ b/notmuch.c @@ -531,6 +531,30 @@ setup_command (unused (int argc), unused (char *argv[])) free (default_path); } + /* Coerce th directory into an absolute directory name. */ + if (*mail_directory != '/') { + char *cwd, *absolute_mail_directory; + + cwd = getcwd (NULL, 0); + if (cwd == NULL) { + fprintf (stderr, "Out of memory.\n"); + exit (1); + } + + if (asprintf (&absolute_mail_directory, "%s/%s", + cwd, mail_directory) < 0) + { + fprintf (stderr, "Out of memory.\n"); + exit (1); + } + + free (cwd); + free (mail_directory); + mail_directory = absolute_mail_directory; + + printf ("Abs: %s\n", mail_directory); + } + notmuch = notmuch_database_create (mail_directory); if (notmuch == NULL) { fprintf (stderr, "Failed to create new notmuch database at %s\n",