[longomatch] Fix launching the migration tool in Windows



commit 1df273d63947ad2f33684308ac0cb5e3adfe88e0
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Oct 31 14:57:06 2014 +0100

    Fix launching the migration tool in Windows

 LongoMatch.Core/Config.cs                    |    7 +++++++
 LongoMatch.Services/Services/ToolsManager.cs |   14 +++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index 6ebc0d1..1c60511 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -148,6 +148,13 @@ namespace LongoMatch
                        }
                }
                
+               public static string LibsDir {
+                       get {
+                               return RelativeToPrefix(Path.Combine ("lib",
+                                                                     Constants.SOFTWARE_NAME.ToLower()));
+                       }
+               }
+
                public static string PluginsDir {
                        get {
                                return RelativeToPrefix(String.Format("lib/{0}/plugins",
diff --git a/LongoMatch.Services/Services/ToolsManager.cs b/LongoMatch.Services/Services/ToolsManager.cs
index 4b79352..f75ac34 100644
--- a/LongoMatch.Services/Services/ToolsManager.cs
+++ b/LongoMatch.Services/Services/ToolsManager.cs
@@ -180,18 +180,14 @@ namespace LongoMatch.Services
                
                void HandleMigrateDB ()
                {
-                       string codeBase = Assembly.GetExecutingAssembly ().CodeBase;
-                       UriBuilder uri = new UriBuilder (codeBase);
-                       string assemblyDir = Path.GetDirectoryName (Uri.UnescapeDataString (uri.Path));
-                       string monoPath = assemblyDir;
-                       monoPath += Path.PathSeparator + Path.Combine (Config.baseDirectory, "lib", "cli", 
"Db4objects.Db4o-8.0");
-                       Console.WriteLine (monoPath);
-                       string migrationExe = Path.Combine (assemblyDir, "migration", "LongoMatch.exe");
+                       string db4oPath = Path.Combine (Config.baseDirectory, "lib", "cli", 
"Db4objects.Db4o-8.0");
+                       string monoPath = Path.GetFullPath (Config.LibsDir) + Path.PathSeparator + 
Path.GetFullPath (db4oPath);
+                       string migrationExe = Path.Combine (Config.LibsDir, "migration", "LongoMatch.exe");
                        ProcessStartInfo startInfo = new ProcessStartInfo ();
                        startInfo.CreateNoWindow = true;
                        startInfo.UseShellExecute = false;
-                       startInfo.Arguments = migrationExe;
-                       startInfo.WorkingDirectory = Path.Combine (Config.baseDirectory, "bin");
+                       startInfo.Arguments = "\"" + migrationExe + "\"";
+                       startInfo.WorkingDirectory = Path.GetFullPath (Path.Combine (Config.baseDirectory, 
"bin"));
                        if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) {
                                startInfo.FileName = "mono";
                        } else {


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