Selaa lähdekoodia

2004-08-13 John Luke <[email protected]>

        * monop.cs: add MONO_PATH support

svn path=/trunk/mcs/; revision=32309
John Luke 21 vuotta sitten
vanhempi
sitoutus
45ff09083c
3 muutettua tiedostoa jossa 23 lisäystä ja 1 poistoa
  1. 4 0
      mcs/tools/monop/ChangeLog
  2. 0 1
      mcs/tools/monop/TODO
  3. 19 0
      mcs/tools/monop/monop.cs

+ 4 - 0
mcs/tools/monop/ChangeLog

@@ -1,3 +1,7 @@
+2004-08-13  John Luke  <[email protected]>
+
+	* monop.cs: add MONO_PATH support
+
 2004-08-13  John Luke  <[email protected]>
 
 	* outline.cs: remove unused isPointer 

+ 0 - 1
mcs/tools/monop/TODO

@@ -7,4 +7,3 @@ TODO
 	* attributes (Serializable, etc)
 	* add declared only / inherited option
 	* handle ~ based paths (ex -r:~/foo.dll)
-	* handle MONO_PATH

+ 19 - 0
mcs/tools/monop/monop.cs

@@ -3,8 +3,10 @@
 //
 // Authors:
 //	Ben Maurer ([email protected])
+//	John Luke  ([email protected])
 //
 // (C) 2004 Ben Maurer
+// (C) 2004 John Luke
 //
 
 
@@ -68,6 +70,9 @@ class MonoP {
 			// if it looks like a fullname try that
 			else if (assembly.Split (',').Length == 4)
 				a = Assembly.Load (assembly);
+			// see if MONO_PATH has it
+			else
+				a = LoadFromMonoPath (assembly);
 		} catch {
 			// ignore exception it gets handled below
 		}
@@ -85,6 +90,20 @@ class MonoP {
 		return a;
 	}
 
+	static Assembly LoadFromMonoPath (string assembly)
+	{
+		// ; on win32, : everywhere else
+		char sep = (Path.DirectorySeparatorChar == '/' ? ':' : ';');
+		string[] paths = Environment.GetEnvironmentVariable ("MONO_PATH").Split (sep);
+		foreach (string path in paths)
+		{	
+			string apath = Path.Combine (path, assembly);
+			if (File.Exists (apath))
+				return Assembly.LoadFrom (apath);	
+		}
+		return null;
+	}
+
 	static Type GetType (string tname)
 	{
 		return GetType (tname, false);