]> arthur.barton.de Git - netatalk.git/commitdiff
Append /
authorFrank Lahm <franklahm@googlemail.com>
Mon, 15 Oct 2012 18:11:57 +0000 (20:11 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Mon, 15 Oct 2012 18:11:57 +0000 (20:11 +0200)
etc/afpd/spotlight_module.c

index c7042eaea32f6e4651767c742a68aac2d44c1f4f..33d818b488a1c96eadb936bb2db178eb9bf9c8cc 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <string.h>
 
+#include <gio/gio.h>
 #include <tracker-sparql.h>
 
 #include <atalk/util.h>
 
 static TrackerSparqlConnection *connection;
 
-const char *tracker_to_unix_path(const char *path)
+const char *tracker_to_unix_path(const char *uri)
 {
-    /* just skip 'file://' */
-    return path + 7;
+    EC_INIT;
+    GFile *f;
+    const char *path;
+
+    EC_NULL_LOG( f = g_file_new_for_uri(uri) );
+    EC_NULL_LOG( path = g_file_get_path(f) );
+
+EC_CLEANUP:
+    if (ret != 0)
+        return NULL;
+    return path;
 }
 
 static int sl_mod_init(void *p)
@@ -64,7 +74,7 @@ static const gchar *map_spotlight_to_sparql_query(slq_t *slq)
 {
     EC_INIT;
     const gchar *sparql_query;
-    const char *sparql_query_format = "SELECT nie:url(?uri) WHERE {?uri fts:match '%s' . ?uri nie:url ?url FILTER(fn:starts-with(?url, 'file://%s')) }";
+    const char *sparql_query_format = "SELECT nie:url(?uri) WHERE {?uri fts:match '%s' . ?uri nie:url ?url FILTER(fn:starts-with(?url, 'file://%s/')) }";
     const char *slquery = slq->slq_qstring;
     char *word, *p;