[longomatch] Delete addins dir if the initialization failed



commit 98032832861b544025e5c3761156a1479b0e6203
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Nov 10 16:44:06 2014 +0100

    Delete addins dir if the initialization failed

 LongoMatch.Addins/AddinsManager.cs |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Addins/AddinsManager.cs b/LongoMatch.Addins/AddinsManager.cs
index cd6c9ea..14c82aa 100644
--- a/LongoMatch.Addins/AddinsManager.cs
+++ b/LongoMatch.Addins/AddinsManager.cs
@@ -17,7 +17,9 @@
 // 
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
+using LongoMatch.Addins.ExtensionPoints;
 using LongoMatch.Core.Common;
 using LongoMatch.Core.Interfaces;
 using LongoMatch.Core.Interfaces.GUI;
@@ -26,7 +28,6 @@ using LongoMatch.Core.Store;
 using LongoMatch.Core.Store.Templates;
 using Mono.Addins;
 using Mono.Addins.Description;
-using LongoMatch.Addins.ExtensionPoints;
 
 [assembly:AddinRoot ("LongoMatch", "1.1")]
 namespace LongoMatch.Addins
@@ -37,7 +38,13 @@ namespace LongoMatch.Addins
                public static void Initialize (string configPath, string searchPath)
                {
                        Log.Information ("Initializing addins at path: " + searchPath);
-                       AddinManager.Initialize (configPath, searchPath);
+                       try {
+                               AddinManager.Initialize (configPath, searchPath);
+                       } catch (Exception ex) {
+                               Log.Exception (ex);
+                               Directory.Delete (configPath, true);
+                               AddinManager.Initialize (configPath, searchPath);
+                       }
                        AddinManager.Registry.Update ();
                }
 


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