]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-config.c
Merge tag 'debian/0.27-3'
[notmuch] / notmuch-config.c
index 746687189f199bd155d5a867186e2a7704ef4605..bf77cc9d43831460c63625a8fcef47a9f6464612 100644 (file)
@@ -660,7 +660,19 @@ _config_set_list (notmuch_config_t *config,
 const char *
 notmuch_config_get_database_path (notmuch_config_t *config)
 {
-    return _config_get (config, &config->database_path, "database", "path");
+    char *db_path = (char *)_config_get (config, &config->database_path, "database", "path");
+
+    if (db_path && *db_path != '/') {
+       /* If the path in the configuration file begins with any
+        * character other than /, presume that it is relative to
+        * $HOME and update as appropriate.
+        */
+       char *abs_path = talloc_asprintf (config, "%s/%s", getenv ("HOME"), db_path);
+       talloc_free (db_path);
+       db_path = config->database_path = abs_path;
+    }
+
+    return db_path;
 }
 
 void
@@ -812,8 +824,14 @@ _item_split (char *item, char **group, char **key)
 static bool
 _stored_in_db (const char *item)
 {
+    const char * db_configs[] = {
+       "index.decrypt",
+    };
     if (STRNCMP_LITERAL (item, "query.") == 0)
        return true;
+    for (size_t i = 0; i < ARRAY_SIZE (db_configs); i++)
+       if (strcmp (item, db_configs[i]) == 0)
+           return true;
     return false;
 }