summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2018-07-16 16:07:19 +0200
committerSam Thursfield <sam@afuera.me.uk>2018-07-16 16:26:57 +0200
commitc8d68246e156365706d44e7f0066b5f964a2e3d0 (patch)
treef572cd808c2fd2966ecabfa14b5698bd63a4891d
parent83e55a8d7eda1769c68230fbc5da408f8b39d282 (diff)
downloadtracker-sam/functional-tests.tar.gz
Honour TRACKER_DB_ONTOLOGIES_DIR override more logicallysam/functional-tests
Previously, we would ignore this environment variable unless the installed directory didn't exist. This meant that one of the functional tests would stop working once you ran `make install`...
-rw-r--r--src/libtracker-common/tracker-domain-ontology.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/libtracker-common/tracker-domain-ontology.c b/src/libtracker-common/tracker-domain-ontology.c
index cd104a1cb..7fc55f8c9 100644
--- a/src/libtracker-common/tracker-domain-ontology.c
+++ b/src/libtracker-common/tracker-domain-ontology.c
@@ -378,16 +378,21 @@ tracker_domain_ontology_initable_init (GInitable *initable,
if (!priv->ontology_location) {
gchar *ontology_path;
- ontology_path = g_build_filename (SHAREDIR, "tracker", "ontologies",
- priv->ontology_name, NULL);
+ if (g_getenv ("TRACKER_DB_ONTOLOGIES_DIR") != NULL) {
+ /* Override for use only by testcases */
+ priv->ontology_location = g_file_new_for_path (g_getenv ("TRACKER_DB_ONTOLOGIES_DIR"));
+ } else {
+ ontology_path = g_build_filename (SHAREDIR, "tracker", "ontologies",
+ priv->ontology_name, NULL);
+
+ if (!g_file_test (ontology_path, G_FILE_TEST_IS_DIR)) {
+ g_error ("Unable to find ontologies in the configured location %s", ontology_path);
+ }
+
+ priv->ontology_location = g_file_new_for_path (ontology_path);
- if (!g_file_test (ontology_path, G_FILE_TEST_IS_DIR)) {
g_free (ontology_path);
- ontology_path = g_strdup (g_getenv ("TRACKER_DB_ONTOLOGIES_DIR"));
}
-
- priv->ontology_location = g_file_new_for_path (ontology_path);
- g_free (ontology_path);
}
end: