[mapguide-commits] r4825 - trunk/Tools/Maestro/MgCooker

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue May 4 01:19:35 EDT 2010


Author: jng
Date: 2010-05-04 01:19:34 -0400 (Tue, 04 May 2010)
New Revision: 4825

Modified:
   trunk/Tools/Maestro/MgCooker/SetupRun.cs
Log:
Fix #1343: Wrap the MgCooker.exe call in a pushd/popd pair so that it is guaranteed to be running from the directory that MgCooker.exe is in

Modified: trunk/Tools/Maestro/MgCooker/SetupRun.cs
===================================================================
--- trunk/Tools/Maestro/MgCooker/SetupRun.cs	2010-05-04 05:09:21 UTC (rev 4824)
+++ trunk/Tools/Maestro/MgCooker/SetupRun.cs	2010-05-04 05:19:34 UTC (rev 4825)
@@ -311,6 +311,9 @@
                 else
                     executable = System.IO.Path.Combine(Application.StartupPath, executable);
 
+                string exeName = System.IO.Path.GetFileName(executable);
+                string exePath = System.IO.Path.GetDirectoryName(executable);
+
                 executable = "\"" + executable + "\"";
 
                 using (System.IO.StreamWriter sw = new System.IO.StreamWriter(saveFileDialog1.FileName))
@@ -325,10 +328,26 @@
                         sw.WriteLine("@echo off");
                     }
 
+                    //If on windows, wrap the exe call in a pushd/popd so that the executable is 
+                    //executed from its own directory
 
+                    if (System.Environment.OSVersion.Platform != PlatformID.MacOSX ||
+                        System.Environment.OSVersion.Platform != PlatformID.Unix)
+                    {
+                        sw.WriteLine("pushd \"" + exePath + "\"");
+                    }
+
                     foreach (Config c in ReadTree())
                     {
-                        sw.Write(executable);
+                        if (System.Environment.OSVersion.Platform != PlatformID.MacOSX ||
+                            System.Environment.OSVersion.Platform != PlatformID.Unix)
+                        {
+                            sw.Write(exeName);
+                        }
+                        else
+                        {
+                            sw.Write(executable);
+                        }
                         sw.Write(" batch");
                         sw.Write(" --mapdefinitions=\"");
                         sw.Write(c.MapDefinition);
@@ -357,6 +376,12 @@
                         sw.Write(args.ToString());
                         sw.WriteLine();
                     }
+
+                    if (System.Environment.OSVersion.Platform != PlatformID.MacOSX ||
+                        System.Environment.OSVersion.Platform != PlatformID.Unix)
+                    {
+                        sw.WriteLine("popd");
+                    }
                 }
             }
         }



More information about the mapguide-commits mailing list