[gnome-builder] app: load plugins from /app/extensions



commit 7c3193932e4f914966258b958664039c1f2e6bc8
Author: Christian Hergert <chergert redhat com>
Date:   Tue Oct 5 10:02:53 2021 -0700

    app: load plugins from /app/extensions
    
    This allows loading extensions that were discovered and merged by the
    Flatpak extension point.
    
    Fixes #1542

 build-aux/flatpak/org.gnome.Builder.json | 3 ++-
 src/libide/gui/ide-application-plugins.c | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/build-aux/flatpak/org.gnome.Builder.json b/build-aux/flatpak/org.gnome.Builder.json
index 51cf5f2ec..07f6fb5fb 100644
--- a/build-aux/flatpak/org.gnome.Builder.json
+++ b/build-aux/flatpak/org.gnome.Builder.json
@@ -673,7 +673,8 @@
                 "cp -a /usr/lib/sdk/llvm12/lib/* /app/lib/",
                 "cp -a /usr/lib/sdk/llvm12/libexec/* /app/libexec/",
                 "cp -a /usr/lib/sdk/llvm12/include/* /app/include/",
-                "cp -a /usr/lib/sdk/llvm12/share/* /app/share/"
+                "cp -a /usr/lib/sdk/llvm12/share/* /app/share/",
+                "install -d /app/extensions"
             ]
         }
     ]
diff --git a/src/libide/gui/ide-application-plugins.c b/src/libide/gui/ide-application-plugins.c
index d62eae3c4..ff27b1aa7 100644
--- a/src/libide/gui/ide-application-plugins.c
+++ b/src/libide/gui/ide-application-plugins.c
@@ -325,6 +325,14 @@ _ide_application_load_plugins_for_startup (IdeApplication *self)
    */
   peas_engine_prepend_search_path (engine, "resource:///plugins", "resource:///plugins");
 
+  /* If we are within the Flatpak, then load any extensions we've
+   * found merged into the extensions directory.
+   */
+  if (ide_is_flatpak ())
+    peas_engine_add_search_path (engine,
+                                 "/app/extensions/lib/gnome-builder/plugins",
+                                 "/app/extensions/lib/gnome-builder/plugins");
+
   /* Our first step is to load our "At-Startup" plugins, which may
    * contain things like command-line handlers. For example, the
    * greeter may handle command-line options and then show the


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