* driver.cs: Prefer the corlib system version when looking for
authorJackson Harper <jackson@novell.com>
Thu, 29 Apr 2004 06:57:45 +0000 (06:57 -0000)
committerJackson Harper <jackson@novell.com>
Thu, 29 Apr 2004 06:57:45 +0000 (06:57 -0000)
assemblies in the GAC. This is still a hack, but its a better hack
now.

svn path=/trunk/mcs/; revision=26279

mcs/mcs/ChangeLog
mcs/mcs/driver.cs

index 5fdadb701aababa382031046b75c71260a335aff..49943ddcc9ec31bbd1e397f0055c897b6dd7405e 100755 (executable)
@@ -1,3 +1,9 @@
+2004-04-29  Jackson Harper  <jackson@ximian.com>
+
+       * driver.cs: Prefer the corlib system version when looking for
+       assemblies in the GAC. This is still a hack, but its a better hack
+       now.
+       
 2004-04-29  Marek Safar  <marek.safar@seznam.cz>
 
        * decl.cs, enum.cs: Improved error 3005 reporting.
index 25202b3b85628c9fd0c56273fbcc16223b35c874..8e10379c034faa680926f6dd94062769c2c470b5 100755 (executable)
@@ -104,6 +104,12 @@ namespace Mono.CSharp
                // Whether the user has specified a different encoder manually
                //
                static bool using_default_encoder = true;
+
+               //
+               // The system version we are using, if not specified on the commandline we
+               // will use the same version as corlib for looking for libraries in the GAC.
+               //
+               static string sys_version;
                
                public static void ShowTime (string msg)
                {
@@ -344,8 +350,11 @@ namespace Mono.CSharp
                        if (!Directory.Exists (asmb_path))
                                return null;
 
-                       canidates = Directory.GetDirectories (asmb_path);
-
+                       canidates = Directory.GetDirectories (asmb_path, GetSysVersion () + "*");
+                       if (canidates.Length == 0)
+                               canidates = Directory.GetDirectories (asmb_path);
+                       if (canidates.Length == 0)
+                               return null;
                        try {
                                Assembly a = Assembly.LoadFrom (Path.Combine (canidates [0], use_name + ".dll"));
                                return a;
@@ -354,6 +363,14 @@ namespace Mono.CSharp
                        }
                }
 
+               static string GetSysVersion ()
+               {
+                       if (sys_version != null)
+                               return sys_version;
+                       sys_version = typeof (object).Assembly.GetName ().Version.ToString ();
+                       return sys_version;
+               }
+
                static public void LoadModule (MethodInfo adder_method, string module)
                {
                        Module m;