[yelp/yelp-3-0] [yelp-application] Resolve relative path before LoadURI over DBus



commit d03d4b79169fbec0a74ac387fca32a012f232f0e
Author: Shaun McCance <shaunm gnome org>
Date:   Fri Mar 19 14:34:37 2010 -0500

    [yelp-application] Resolve relative path before LoadURI over DBus

 src/yelp-application.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/yelp-application.c b/src/yelp-application.c
index 5c47386..d908f57 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -207,7 +207,16 @@ yelp_application_run (YelpApplication  *app,
         request == DBUS_REQUEST_NAME_REPLY_IN_QUEUE) {
         gchar *newuri;
 
-        newuri = g_strdup (uri);
+        if (uri && (strchr (uri, ':') || (uri[0] == '/')))
+            newuri = uri;
+        else {
+            GFile *base, *new;
+            gchar *cur = g_get_current_dir ();
+            base = g_file_new_for_path (cur);
+            new = g_file_resolve_relative_path (base, uri);
+            newuri = g_file_get_uri (new);
+            g_free (cur);
+        }
 
         proxy = dbus_g_proxy_new_for_name (priv->connection,
                                            "org.gnome.Yelp",
@@ -222,7 +231,8 @@ yelp_application_run (YelpApplication  *app,
             g_error_free (error);
         }
 
-        g_free (newuri);
+        if (newuri != uri)
+            g_free (newuri);
         g_object_unref (proxy);
         return 1;
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]