[gnome-builder] terminal: setup SRCDIR for regular terminals



commit 958e55c43cd8e0cf665a18b4e51c3321cd5cd907
Author: Christian Hergert <chergert redhat com>
Date:   Tue Apr 30 14:17:43 2019 -0700

    terminal: setup SRCDIR for regular terminals

 src/libide/terminal/ide-terminal-launcher.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/libide/terminal/ide-terminal-launcher.c b/src/libide/terminal/ide-terminal-launcher.c
index eb591c2cd..0c2de3c08 100644
--- a/src/libide/terminal/ide-terminal-launcher.c
+++ b/src/libide/terminal/ide-terminal-launcher.c
@@ -45,6 +45,7 @@ struct _IdeTerminalLauncher
   gchar        *shell;
   gchar        *title;
   IdeRuntime   *runtime;
+  IdeContext   *context;
   LauncherKind  kind;
 };
 
@@ -227,6 +228,16 @@ spawn_host_launcher (IdeTerminalLauncher *self,
 
   ide_subprocess_launcher_setenv (launcher, "SHELL", shell, TRUE);
 
+  if (self->context != NULL)
+    {
+      g_autoptr(GFile) workdir = ide_context_ref_workdir (self->context);
+
+      ide_subprocess_launcher_setenv (launcher,
+                                      "SRCDIR",
+                                      g_file_peek_path (workdir),
+                                      FALSE);
+    }
+
   if (!(subprocess = ide_subprocess_launcher_spawn (launcher, NULL, &error)))
     ide_task_return_error (task, g_steal_pointer (&error));
   else
@@ -639,6 +650,7 @@ ide_terminal_launcher_new (IdeContext *context)
   self = g_object_new (IDE_TYPE_TERMINAL_LAUNCHER, NULL);
   self->kind = LAUNCHER_KIND_HOST;
   self->cwd = g_file_get_path (workdir);
+  self->context = g_object_ref (context);
 
   return g_steal_pointer (&self);
 }


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