]> git.notmuchmail.org Git - notmuch/blobdiff - lib/database.cc
lib: Make notmuch_database_get_directory return NULL if the directory is not found
[notmuch] / lib / database.cc
index b4c76b4ea622e561729deb78a7874689dd766e15..e27a0e1664cfac7d2731402f7e3c675c19f57eda 100644 (file)
@@ -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());