[gnome-software] Fix running GNOME Software in an xdg-app sandbox



commit 37d1be7539e724cbafc896289d4b53b548905814
Author: Richard Hughes <richard hughsie com>
Date:   Mon Feb 1 12:06:16 2016 +0000

    Fix running GNOME Software in an xdg-app sandbox

 src/plugins/gs-plugin-xdg-app.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-xdg-app.c b/src/plugins/gs-plugin-xdg-app.c
index d52d317..b226493 100644
--- a/src/plugins/gs-plugin-xdg-app.c
+++ b/src/plugins/gs-plugin-xdg-app.c
@@ -108,14 +108,30 @@ gs_plugin_ensure_installation (GsPlugin *plugin,
                               GCancellable *cancellable,
                               GError **error)
 {
+       g_autofree gchar *install_path = NULL;
        g_autoptr(AsProfileTask) ptask = NULL;
+       g_autoptr(GFile) install_file = NULL;
+
        if (plugin->priv->installation != NULL)
                return TRUE;
 
+       /* If we're running INSIDE the xdg-app environment we'll have the
+        * env var XDG_DATA_HOME set to "~/.var/app/org.gnome.Software/data"
+        * so specify the path manually to get the real data */
+       install_path = g_build_filename (g_get_home_dir (),
+                                        ".local",
+                                        "share",
+                                        "xdg-app",
+                                        NULL);
+       install_file = g_file_new_for_path (install_path);
+
        /* FIXME: this should default to system-wide, but we need a permissions
         * helper to elevate privs */
        ptask = as_profile_start_literal (plugin->profile, "xdg-app::ensure-origin");
-       plugin->priv->installation = xdg_app_installation_new_user (cancellable, error);
+       plugin->priv->installation = xdg_app_installation_new_for_path (install_file,
+                                                                       TRUE,
+                                                                       cancellable,
+                                                                       error);
        if (plugin->priv->installation == NULL)
                return FALSE;
 


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