[mapguide-commits] r5030 - trunk/Tools/Maestro/MaestroAPI

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Jul 15 00:08:24 EDT 2010


Author: jng
Date: 2010-07-15 04:08:24 +0000 (Thu, 15 Jul 2010)
New Revision: 5030

Modified:
   trunk/Tools/Maestro/MaestroAPI/ConnectionProviderRegistry.cs
Log:
Fix #1406: Use Assembly.GetExecutingAssembly().CodeBase to ascertain the true working directory and initialize the ConnectionProviderRegistry with this path.


Modified: trunk/Tools/Maestro/MaestroAPI/ConnectionProviderRegistry.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/ConnectionProviderRegistry.cs	2010-07-14 16:22:02 UTC (rev 5029)
+++ trunk/Tools/Maestro/MaestroAPI/ConnectionProviderRegistry.cs	2010-07-15 04:08:24 UTC (rev 5030)
@@ -39,13 +39,23 @@
         static Dictionary<string, Type> _ctors;
         static List<ConnectionProviderEntry> _providers;
 
+        static string _dllRoot;
+
         static ConnectionProviderRegistry()
         {
             _ctors = new Dictionary<string, Type>();
             _providers = new List<ConnectionProviderEntry>();
 
+            var path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
+            path = System.IO.Path.Combine(path, PROVIDER_CONFIG);
+
+            //Convert file uri to path syntax
+            path = path.Substring(6).Replace('/', '\\');
+
+            _dllRoot = System.IO.Path.GetDirectoryName(path);
+
             XmlDocument doc = new XmlDocument();
-            doc.Load(PROVIDER_CONFIG);
+            doc.Load(path);
 
             XmlNodeList providers = doc.SelectNodes("//ConnectionProviderRegistry/ConnectionProvider");
             foreach (XmlNode prov in providers)
@@ -55,6 +65,9 @@
                 string dll = prov["Assembly"].InnerText;
                 string type = prov["Type"].InnerText;
 
+                if (!System.IO.Path.IsPathRooted(dll))
+                    dll = System.IO.Path.Combine(_dllRoot, dll);
+
                 Assembly asm = Assembly.LoadFrom(dll);
                 Type t = asm.GetType(type);
 



More information about the mapguide-commits mailing list