summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2017-05-29 18:59:32 +0200
committerCarlos Garnacho <carlosg@gnome.org>2017-06-28 23:55:22 +0200
commit4dcfeaf0912500f9399c697dd53bbc9fc27e024d (patch)
treebed94fc953cc9d668ed99cdfb91cf2bd41c86871 /utils
parente16a0a0b15d93a4a8fd82657c3df1da9ce48f198 (diff)
downloadtracker-4dcfeaf0912500f9399c697dd53bbc9fc27e024d.tar.gz
libtracker-data: Make TrackerTurtleReader take GFiles
Instead of file paths. This is so we can load ontology files from resource:// uris. All callers have been changed accordingly.
Diffstat (limited to 'utils')
-rw-r--r--utils/ontology/data-validator.c10
-rw-r--r--utils/ontology/ontology-validator.c6
2 files changed, 12 insertions, 4 deletions
diff --git a/utils/ontology/data-validator.c b/utils/ontology/data-validator.c
index d80cdb583..38dbd90ac 100644
--- a/utils/ontology/data-validator.c
+++ b/utils/ontology/data-validator.c
@@ -120,6 +120,7 @@ load_ontology_files (const gchar *services_dir)
while (conf_file) {
TrackerTurtleReader *reader;
GError *error = NULL;
+ GFile *file;
if (!g_str_has_suffix (conf_file, "ontology")) {
conf_file = g_dir_read_name (services);
@@ -127,8 +128,10 @@ load_ontology_files (const gchar *services_dir)
}
fullpath = g_build_filename (dir_uri, conf_file, NULL);
+ file = g_file_new_for_path (fullpath);
- reader = tracker_turtle_reader_new (fullpath, NULL);
+ reader = tracker_turtle_reader_new (file, NULL);
+ g_object_unref (file);
while (error == NULL && tracker_turtle_reader_next (reader, &error)) {
turtle_load_ontology (tracker_turtle_reader_get_subject (reader),
@@ -162,6 +165,7 @@ main (gint argc, gchar **argv)
GOptionContext *context;
TrackerTurtleReader *reader;
GError *error = NULL;
+ GFile *file;
/* Translators: this messagge will apper immediately after the */
/* usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE> */
@@ -189,7 +193,9 @@ main (gint argc, gchar **argv)
//"/home/ivan/devel/codethink/tracker-ssh/data/services"
load_ontology_files (ontology_dir);
- reader = tracker_turtle_reader_new (ttl_file, NULL);
+ file = g_file_new_for_commandline_arg (ttl_file);
+ reader = tracker_turtle_reader_new (file, NULL);
+ g_object_unref (file);
while (error == NULL && tracker_turtle_reader_next (reader, &error)) {
turtle_statement_handler (tracker_turtle_reader_get_subject (reader),
diff --git a/utils/ontology/ontology-validator.c b/utils/ontology/ontology-validator.c
index 7aa79efec..8d934337d 100644
--- a/utils/ontology/ontology-validator.c
+++ b/utils/ontology/ontology-validator.c
@@ -176,12 +176,13 @@ turtle_load_ontology (const gchar *turtle_subject,
}
static void
-process_file (const gchar *ttl_file)
+process_file (const gchar *ttl_path)
{
TrackerTurtleReader *reader;
GError *error = NULL;
+ GFile *ttl_file = g_file_new_for_path (ttl_path);
- g_print ("Processing %s\n", ttl_file);
+ g_print ("Processing %s\n", ttl_path);
reader = tracker_turtle_reader_new (ttl_file, NULL);
@@ -192,6 +193,7 @@ process_file (const gchar *ttl_file)
}
g_object_unref (reader);
+ g_object_unref (ttl_file);
if (error) {
g_message ("Turtle parse error: %s", error->message);