X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fdatabase.cc;h=761dc1a24c3a26247dcfa7734ceb7141f02df36a;hp=b4c76b4ea622e561729deb78a7874689dd766e15;hb=cdd698f96976dc8fc43efd19c452d0fca48e2618;hpb=67ae2377a9ec2da296a2e012352f962664a4d1a8 diff --git a/lib/database.cc b/lib/database.cc index b4c76b4e..761dc1a2 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1328,12 +1328,9 @@ notmuch_database_get_directory (notmuch_database_t *notmuch, return NOTMUCH_STATUS_NULL_POINTER; *directory = NULL; - /* XXX Handle read-only databases properly */ - if (notmuch->mode == NOTMUCH_DATABASE_MODE_READ_ONLY) - return NOTMUCH_STATUS_READ_ONLY_DATABASE; - try { - *directory = _notmuch_directory_create (notmuch, path, NOTMUCH_FIND_CREATE, &status); + *directory = _notmuch_directory_create (notmuch, path, + NOTMUCH_FIND_LOOKUP, &status); } catch (const Xapian::Error &error) { fprintf (stderr, "A Xapian exception occurred getting directory: %s.\n", error.get_msg().c_str()); @@ -1898,8 +1895,8 @@ notmuch_database_find_message_by_filename (notmuch_database_t *notmuch, try { status = _notmuch_database_filename_to_direntry ( - local, notmuch, filename, NOTMUCH_FIND_CREATE, &direntry); - if (status) + local, notmuch, filename, NOTMUCH_FIND_LOOKUP, &direntry); + if (status || !direntry) goto DONE; term = talloc_asprintf (local, "%s%s", prefix, direntry);