[gnome-builder/wip/tingping/runner: 3/3] Fix running projects using GSettings



commit 0187063218abc916dc66270ed65fec2c10b2bc44
Author: Patrick Griffis <tingping tingping se>
Date:   Tue Aug 23 18:24:58 2016 -0400

    Fix running projects using GSettings

 libide/runtimes/ide-runtime.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/libide/runtimes/ide-runtime.c b/libide/runtimes/ide-runtime.c
index 984e59e..bf4f40f 100644
--- a/libide/runtimes/ide-runtime.c
+++ b/libide/runtimes/ide-runtime.c
@@ -175,10 +175,14 @@ ide_runtime_real_create_runner (IdeRuntime     *self,
 {
   g_autofree gchar *name = NULL;
   g_autofree gchar *binpath = NULL;
+  g_autofree gchar *schemadir = NULL;
+  g_autofree gchar *parentpath = NULL;
   g_autoptr(GFile) installdir = NULL;
+  g_autoptr(GFile) parentdir = NULL;
   g_autoptr(GFile) bin = NULL;
   IdeContext *context;
   IdeRunner *runner;
+  IdeEnvironment *env;
   gchar *slash;
 
   g_assert (IDE_IS_RUNTIME (self));
@@ -205,6 +209,18 @@ ide_runtime_real_create_runner (IdeRuntime     *self,
       name = tmp;
     }
 
+  /* GSchema requires an env var for non-standard dirs */
+  parentdir = g_file_get_parent (installdir);
+  if (parentdir)
+    {
+      parentpath = g_file_get_path (parentdir);
+      schemadir = g_build_filename (parentpath, "share",
+                                "glib-2.0", "schemas", NULL);
+
+      env = ide_runner_get_environment (runner);
+      ide_environment_setenv (env, "GSETTINGS_SCHEMA_DIR", schemadir);
+    }
+
   bin = g_file_get_child (installdir, name);
   binpath = g_file_get_path (bin);
 


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