[gnome-builder] runmanager: add arguments from configuration



commit e24d89d21481c7e1cc0a0e55c7c82b10d788245c
Author: Christian Hergert <chergert redhat com>
Date:   Sun Aug 6 16:38:18 2017 -0700

    runmanager: add arguments from configuration
    
    If the build configuration has run options specified, we can use that
    to run the application.

 libide/runner/ide-run-manager.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libide/runner/ide-run-manager.c b/libide/runner/ide-run-manager.c
index 2a05a2c..22ffe02 100644
--- a/libide/runner/ide-run-manager.c
+++ b/libide/runner/ide-run-manager.c
@@ -354,6 +354,7 @@ static void
 do_run_async (IdeRunManager *self,
               GTask         *task)
 {
+  g_auto(GStrv) run_argv = NULL;
   IdeBuildTarget *build_target;
   IdeContext *context;
   IdeConfigurationManager *config_manager;
@@ -361,6 +362,7 @@ do_run_async (IdeRunManager *self,
   IdeRuntime *runtime;
   g_autoptr(IdeRunner) runner = NULL;
   GCancellable *cancellable;
+  const gchar *run_opts;
 
   IDE_ENTRY;
 
@@ -394,6 +396,19 @@ do_run_async (IdeRunManager *self,
   g_assert (IDE_IS_RUNNER (runner));
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
+  /* Add our run arguments if specified in the config. */
+  if (NULL != (run_opts = ide_configuration_get_run_opts (config)))
+    {
+      g_auto(GStrv) argv = NULL;
+      gint argc;
+
+      if (g_shell_parse_argv (run_opts, &argc, &argv, NULL))
+        {
+          for (gint i = 0; i < argc; i++)
+            ide_runner_append_argv (runner, argv[i]);
+        }
+    }
+
   /*
    * If the current handler has a callback specified (our default "run" handler
    * does not), then we need to allow that handler to prepare the runner.


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