[PATCH v2 4/5] ruby: Update for changes to notmuch_database_get_directory

Austin Clements amdragon at MIT.EDU
Sun May 13 16:36:12 PDT 2012


---
 bindings/ruby/database.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c
index 409d54f..e84f726 100644
--- a/bindings/ruby/database.c
+++ b/bindings/ruby/database.c
@@ -252,6 +252,7 @@ VALUE
 notmuch_rb_database_get_directory (VALUE self, VALUE pathv)
 {
     const char *path;
+    notmuch_status_t ret;
     notmuch_directory_t *dir;
     notmuch_database_t *db;
 
@@ -260,11 +261,11 @@ notmuch_rb_database_get_directory (VALUE self, VALUE pathv)
     SafeStringValue (pathv);
     path = RSTRING_PTR (pathv);
 
-    dir = notmuch_database_get_directory (db, path);
-    if (!dir)
-        rb_raise (notmuch_rb_eXapianError, "Xapian exception");
-
-    return Data_Wrap_Struct (notmuch_rb_cDirectory, NULL, NULL, dir);
+    ret = notmuch_database_get_directory (db, path, &dir);
+    notmuch_rb_status_raise (ret);
+    if (dir)
+	return Data_Wrap_Struct (notmuch_rb_cDirectory, NULL, NULL, dir);
+    return Qnil;
 }
 
 /*
-- 
1.7.10



More information about the notmuch mailing list