summaryrefslogtreecommitdiff
path: root/src/libtracker-common/tracker-domain-ontology.c
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2018-08-11 20:42:18 +0200
committerSam Thursfield <sam@afuera.me.uk>2018-08-11 21:33:08 +0200
commitdd59bb4ff5088064c28cca2313255396f97920bf (patch)
tree2616fb8c884392ff2d425611b2ac542c051a8b28 /src/libtracker-common/tracker-domain-ontology.c
parent9840ab01f1b609fe2f9674b4a491cf4c452b6273 (diff)
downloadtracker-sam/domain-rules-outside-usr.tar.gz
Allow use of domain rules that aren't installed into /usrsam/domain-rules-outside-usr
Currently Tracker domain rules must be installed inside Tracker's data directory (usually /usr/share/tracker). This is limiting as it means only system packages can add them. A program installed into /opt is unable to use a custom domain, for example. Since Tracker is implemented as a system of daemons, it's not particularly straight forward to work around this by setting XDG_DATA_DIRS= to point somewhere non-standard either. This patch removes this restriction in a simple way: it allows users to pass a full path to the domain rule, rather than just the base name.
Diffstat (limited to 'src/libtracker-common/tracker-domain-ontology.c')
-rw-r--r--src/libtracker-common/tracker-domain-ontology.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libtracker-common/tracker-domain-ontology.c b/src/libtracker-common/tracker-domain-ontology.c
index 65a3fda0b..f8de59ab5 100644
--- a/src/libtracker-common/tracker-domain-ontology.c
+++ b/src/libtracker-common/tracker-domain-ontology.c
@@ -302,7 +302,17 @@ tracker_domain_ontology_initable_init (GInitable *initable,
domain_ontology = TRACKER_DOMAIN_ONTOLOGY (initable);
priv = tracker_domain_ontology_get_instance_private (domain_ontology);
- if (priv->name) {
+ if (priv->name && priv->name[0] == '/') {
+ if (!g_file_test (priv->name, G_FILE_TEST_IS_REGULAR)) {
+ inner_error = g_error_new (G_KEY_FILE_ERROR,
+ G_KEY_FILE_ERROR_NOT_FOUND,
+ "Could not find rule at '%s'",
+ priv->name);
+ goto end;
+ }
+
+ path = g_strdup (priv->name);
+ } else if (priv->name) {
path = find_rule_in_data_dirs (priv->name);
if (!path) {