aboutsummaryrefslogtreecommitdiff
path: root/lib/database.cc
diff options
context:
space:
mode:
authorAustin Clements <amdragon@MIT.EDU>2012-05-18 00:13:34 -0400
committerDavid Bremner <bremner@debian.org>2012-05-23 22:30:20 -0300
commitf69314fbd37f403a395b7c1c44595c8f696b05b7 (patch)
tree1d533e466d14fd0c886fff2622e3ffd4895f2a4e /lib/database.cc
parent70ca3444c75beaa693fcac411dd6a2819bd4341e (diff)
lib: Make directory document creation optional for _notmuch_directory_create
Previously this function would create directory documents if they didn't exist. As a result, it could only be used on writable databases. This adds an argument to make creation optional and to make this function work on read-only databases. We use a flag argument to avoid a bare boolean and to permit future expansion. Both callers have been updated, but currently retain the old behavior. We'll take advantage of the new argument in the following patches.
Diffstat (limited to 'lib/database.cc')
-rw-r--r--lib/database.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/database.cc b/lib/database.cc
index f8c4a7d..df996a9 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -956,7 +956,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
document.get_value (NOTMUCH_VALUE_TIMESTAMP));
directory = _notmuch_directory_create (notmuch, term.c_str() + 10,
- &status);
+ NOTMUCH_FIND_CREATE, &status);
notmuch_directory_set_mtime (directory, mtime);
notmuch_directory_destroy (directory);
}
@@ -1210,7 +1210,7 @@ _notmuch_database_find_directory_id (notmuch_database_t *notmuch,
return NOTMUCH_STATUS_SUCCESS;
}
- directory = _notmuch_directory_create (notmuch, path, &status);
+ directory = _notmuch_directory_create (notmuch, path, NOTMUCH_FIND_CREATE, &status);
if (status) {
*directory_id = -1;
return status;
@@ -1320,7 +1320,7 @@ notmuch_database_get_directory (notmuch_database_t *notmuch,
return NOTMUCH_STATUS_READ_ONLY_DATABASE;
try {
- *directory = _notmuch_directory_create (notmuch, path, &status);
+ *directory = _notmuch_directory_create (notmuch, path, NOTMUCH_FIND_CREATE, &status);
} catch (const Xapian::Error &error) {
fprintf (stderr, "A Xapian exception occurred getting directory: %s.\n",
error.get_msg().c_str());