[longomatch] Only load addins from the current prefix
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Only load addins from the current prefix
- Date: Sat, 22 Nov 2014 10:53:09 +0000 (UTC)
commit 14ea95538d79fc998df4d2d5c569bd213feed0a8
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Thu Nov 13 19:44:43 2014 +0100
Only load addins from the current prefix
LongoMatch.Addins/AddinsManager.cs | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Addins/AddinsManager.cs b/LongoMatch.Addins/AddinsManager.cs
index 842de8d..1970d05 100644
--- a/LongoMatch.Addins/AddinsManager.cs
+++ b/LongoMatch.Addins/AddinsManager.cs
@@ -38,6 +38,7 @@ namespace LongoMatch.Addins
public static void Initialize (string configPath, string searchPath)
{
+ searchPath = Path.GetFullPath (searchPath);
Log.Information ("Initializing addins at path: " + searchPath);
try {
AddinManager.Initialize (configPath, searchPath);
@@ -47,6 +48,17 @@ namespace LongoMatch.Addins
AddinManager.Initialize (configPath, searchPath);
}
AddinManager.Registry.Update ();
+ foreach (Addin addin in AddinManager.Registry.GetAddins ()) {
+ string addinPath = addin.Description.AddinFile;
+
+ if (!addinPath.StartsWith (searchPath) &&
+ !addinPath.StartsWith (Path.GetFullPath (Config.baseDirectory))) {
+ AddinManager.Registry.DisableAddin (addin.Id);
+ Log.Debug ("Disable addin at path " + addinPath);
+ } else {
+ AddinManager.Registry.EnableAddin (addin.Id);
+ }
+ }
}
public static bool RegisterGStreamerPlugins ()
@@ -140,6 +152,9 @@ namespace LongoMatch.Addins
plugins = new Dictionary<AddinDescription, List<ConfigurablePlugin>> ();
foreach (Addin addin in AddinManager.Registry.GetAddins ()) {
+ if (!addin.Enabled) {
+ continue;
+ }
foreach (Extension ext in addin.Description.MainModule.Extensions) {
paths.Add (ext.Path);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]