[longomatch] Try to handle a bit more errors deleting plugins cache



commit ac9d438af10727aeb79124b0a144b68ad778b76f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Apr 21 18:21:24 2015 +0200

    Try to handle a bit more errors deleting plugins cache

 LongoMatch.Addins/AddinsManager.cs |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.Addins/AddinsManager.cs b/LongoMatch.Addins/AddinsManager.cs
index 2bc4148..f967eaa 100644
--- a/LongoMatch.Addins/AddinsManager.cs
+++ b/LongoMatch.Addins/AddinsManager.cs
@@ -46,11 +46,20 @@ namespace LongoMatch.Addins
                        }
                        searchPath = Path.GetFullPath (searchPath);
                        Log.Information ("Initializing addins at path: " + searchPath);
+                       /* First initialization can fail after upgrades */
                        try {
                                AddinManager.Initialize (configPath, searchPath);
-                       } catch (Exception ex) {
-                               Log.Exception (ex);
-                               Directory.Delete (configPath, true);
+                       } catch (Exception ex1) {
+                               Log.Exception (ex1);
+                               try {
+                                       Directory.Delete (configPath, true);
+                               } catch (Exception ex2) {
+                                       Log.Exception (ex2);
+                                       /* Something can be very wrong at this point if we couldn't delete
+                                        * the addins cache. This can happens in windows if the directory
+                                        * is un use by another instance.
+                                        * Ignore it and try to intialize again just in case. */
+                               }
                                AddinManager.Initialize (configPath, searchPath);
                        }
                        AddinManager.Registry.Update ();


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