[gnome-builder] terminal: place user into build directory for build terminal
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] terminal: place user into build directory for build terminal
- Date: Thu, 7 Jun 2018 21:19:12 +0000 (UTC)
commit 27c1eb1f71be2183ce8a444e4afeb6f2ce75b2de
Author: Christian Hergert <chergert redhat com>
Date: Thu Jun 7 14:18:33 2018 -0700
terminal: place user into build directory for build terminal
If we're doing a "build environment" terminal, we should place the user
into the build directory so they don't need to cd $BUILDDIR.
This does a synchronous check to see if the directory exists, but that will
almost always be in the dentry cache since we should have already made the
directory and accessed it recently.
Fixes #526
src/plugins/terminal/gb-terminal-workbench-addin.c | 23 +++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/terminal/gb-terminal-workbench-addin.c
b/src/plugins/terminal/gb-terminal-workbench-addin.c
index c6e5c8078..de11a6f49 100644
--- a/src/plugins/terminal/gb-terminal-workbench-addin.c
+++ b/src/plugins/terminal/gb-terminal-workbench-addin.c
@@ -66,6 +66,24 @@ find_runtime (IdeWorkbench *workbench)
return ide_configuration_get_runtime (config);
}
+static gchar *
+find_builddir (IdeWorkbench *workbench)
+{
+ IdeContext *context;
+ IdeBuildManager *build_manager;
+ IdeBuildPipeline *pipeline;
+ const gchar *builddir = NULL;
+
+ if ((context = ide_workbench_get_context (workbench)) &&
+ (build_manager = ide_context_get_build_manager (context)) &&
+ (pipeline = ide_build_manager_get_pipeline (build_manager)) &&
+ (builddir = ide_build_pipeline_get_builddir (pipeline)) &&
+ g_file_test (builddir, G_FILE_TEST_IS_DIR))
+ return g_strdup (builddir);
+
+ return NULL;
+}
+
static void
new_terminal_activate (GSimpleAction *action,
GVariant *param,
@@ -86,7 +104,10 @@ new_terminal_activate (GSimpleAction *action,
name = g_action_get_name (G_ACTION (action));
if (g_strcmp0 (name, "new-terminal-in-runtime") == 0)
- runtime = find_runtime (self->workbench);
+ {
+ runtime = find_runtime (self->workbench);
+ cwd = find_builddir (self->workbench);
+ }
else if (g_strcmp0 (name, "debug-terminal") == 0)
run_on_host = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]