[mutter/wip/carlosg/frames-client: 12/13] core: Add fallback location for the mutter-x11-frames executable




commit 89894c2687b6e097c30bfed9f49c7c4edc1a1754
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Sep 17 10:28:41 2022 +0200

    core: Add fallback location for the mutter-x11-frames executable
    
    Typically this will be installed in libexecdir and run from there, but
    this requires "ninja install" before "ninja test", which is not ideal.
    
    Add a fallback specific to the situation of meson tests, so that the
    frames client is executed from the builddir instead. In order to
    avoid disk seeks checking for file existence, and envvars to tweak
    Mutter behavior, this is only done as a last resort, the installed
    executable in libexecdir is still preferred.

 src/core/frame.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/core/frame.c b/src/core/frame.c
index 92aa6ebcd7..a9110e6598 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -534,8 +534,21 @@ on_x11_display_setup (MetaDisplay *display,
   proc = g_subprocess_launcher_spawnv (launcher, args, &error);
   if (error)
     {
-      g_warning ("Could not launch X11 frames client: %s", error->message);
-      return;
+      if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
+        {
+          /* Fallback case for uninstalled tests, relies on CWD being
+           * the builddir, as it is the case during "ninja test".
+           */
+          g_clear_error (&error);
+          args[0] = "./src/frames/mutter-x11-frames";
+          proc = g_subprocess_launcher_spawnv (launcher, args, &error);
+        }
+
+      if (error)
+        {
+          g_warning ("Could not launch X11 frames client: %s", error->message);
+          return;
+        }
     }
 
   g_subprocess_wait_async (proc, NULL, on_frames_died, display);


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