[longomatch] Don't override the existing MONO_PATH launching the migration tool



commit afb1bb1fdb1635ff3e1153b67e79b49a1b7dd4c3
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Oct 14 18:45:21 2014 +0200

    Don't override the existing MONO_PATH launching the migration tool

 LongoMatch.Services/Services/ToolsManager.cs |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.Services/Services/ToolsManager.cs b/LongoMatch.Services/Services/ToolsManager.cs
index 9286d04..3fc7b47 100644
--- a/LongoMatch.Services/Services/ToolsManager.cs
+++ b/LongoMatch.Services/Services/ToolsManager.cs
@@ -178,9 +178,9 @@ namespace LongoMatch.Services
                
                void HandleMigrateDB ()
                {
-                       string codeBase = Assembly.GetExecutingAssembly().CodeBase;
-                       UriBuilder uri = new UriBuilder(codeBase);
-                       string assemblyDir = Path.GetDirectoryName (Uri.UnescapeDataString(uri.Path));
+                       string codeBase = Assembly.GetExecutingAssembly ().CodeBase;
+                       UriBuilder uri = new UriBuilder (codeBase);
+                       string assemblyDir = Path.GetDirectoryName (Uri.UnescapeDataString (uri.Path));
                        string migrationExe = Path.Combine (assemblyDir, "migration", "LongoMatch.exe");
                        ProcessStartInfo startInfo = new ProcessStartInfo ();
                        startInfo.CreateNoWindow = true;
@@ -189,8 +189,12 @@ namespace LongoMatch.Services
                        }
                        startInfo.FileName = "mono";
                        startInfo.Arguments = migrationExe;
-                       startInfo.EnvironmentVariables.Add ("MONO_PATH", assemblyDir);
-                       using (System.Diagnostics.Process exeProcess = 
System.Diagnostics.Process.Start(startInfo)) {
+                       if (startInfo.EnvironmentVariables.ContainsKey ("MONO_PATH")) {
+                               startInfo.EnvironmentVariables["MONO_PATH"] += Path.PathSeparator + 
assemblyDir;
+                       } else {
+                               startInfo.EnvironmentVariables.Add ("MONO_PATH", assemblyDir);
+                       }
+                       using (Process exeProcess = Process.Start(startInfo)) {
                                exeProcess.WaitForExit ();
                        }
                }


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