[geary/mjog/user-plugins: 5/26] Application.PluginManager: Only load builtins if in install dir



commit 627bfb7c89aa55ae7b1f8b05f3ef4e28002424c8
Author: Michael Gratton <mike vee net>
Date:   Mon Mar 2 12:04:16 2020 +1100

    Application.PluginManager: Only load builtins if in install dir
    
    Only trust builtin plugins if they have been installed.

 src/client/application/application-plugin-manager.vala | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/client/application/application-plugin-manager.vala 
b/src/client/application/application-plugin-manager.vala
index ffc76de1..ffcc256d 100644
--- a/src/client/application/application-plugin-manager.vala
+++ b/src/client/application/application-plugin-manager.vala
@@ -23,9 +23,9 @@ public class Application.PluginManager : GLib.Object {
                          NotificationContext notifications) {
         this.application = application;
         this.engine = Peas.Engine.get_default();
-        this.engine.add_search_path(
-            application.get_app_plugins_dir().get_path(), null
-        );
+
+        string builtin_path = application.get_app_plugins_dir().get_path();
+        this.engine.add_search_path(builtin_path, null);
 
         this.notifications = notifications;
         this.notification_extensions = new Peas.ExtensionSet(
@@ -51,7 +51,8 @@ public class Application.PluginManager : GLib.Object {
             string name = info.get_module_name();
             try {
                 if (info.is_available()) {
-                    if (info.is_builtin()) {
+                    if (info.is_builtin() &&
+                        info.get_module_dir().has_prefix(builtin_path)) {
                         debug("Loading built-in plugin: %s", name);
                         this.engine.load_plugin(info);
                     }


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