[Mono-list] Filesystem-handling diffs

Tim Haynes thaynes@openlinksw.com (Tim Haynes)
Tue, 21 Jan 2003 13:33:56 +0000


--=-=-=

Howdo,

Please find attached diffs to:

* AspGenerator.cs/BaseCompiler.cs 
- fixed a bug where a directory-name containing space caused problems
referencing dlls inside it (changed the 0x20 space separator to a '|'
character). Also put the /r: mcs option in double quotes - this will
also allow references to filenames with space.

* CachingCompiler.cs 
- fixed to call mcs.bat instead of mcs on Windows which caused
problems using the mono runtime on systems without .NET installed.
Without the fix this will call 'mcs ....'. The explicit calling of
mcs.bat allows more control over what's started instead of getting
.NET's mcs.exe unintentionally.

* driver.cs
- Removed a hard-coded "/" to use whatever the DirectorySeparatorChar
is on the platform in question. Otherwise, one ends up searching for
file://c:\dfgdfg\sdfsdf\...\*corlib.dll. The fix will allow correct
finding of that directory on windows without breaking it on Linux.

A possible ChangeLog entry would be:

2003-01-21  Tim Haynes <thaynes@openlinksw.com>

        * AspGenerator.cs
        * BaseCompiler.cs
        * CachingCompiler.cs
        * driver.cs: changes to work around spaces and
        directory-separators in the local filesystem.

~Tim
-- 
Product Development Consultant
OpenLink Software
Tel: +44 (0) 20 8681 7701
Web: <http://www.openlinksw.com/>
Universal Data Access & Data Integration Technology Providers


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=win-path-changes.diff

Index: class/System.Web/System.Web.Compilation/AspGenerator.cs
===================================================================
RCS file: /cvs/public/mcs/class/System.Web/System.Web.Compilation/AspGenerator.cs,v
retrieving revision 1.21
diff -u -r1.21 AspGenerator.cs
--- class/System.Web/System.Web.Compilation/AspGenerator.cs	16 Jan 2003 07:11:58 -0000	1.21
+++ class/System.Web/System.Web.Compilation/AspGenerator.cs	21 Jan 2003 13:28:05 -0000
@@ -667,7 +667,7 @@
 		if (references == null)
 			references = dll;
 		else
-			references = references + " " + dll;
+			references = references + "|" + dll;
 
 		Options ["References"] = references;
 	}
Index: class/System.Web/System.Web.Compilation/BaseCompiler.cs
===================================================================
RCS file: /cvs/public/mcs/class/System.Web/System.Web.Compilation/BaseCompiler.cs,v
retrieving revision 1.3
diff -u -r1.3 BaseCompiler.cs
--- class/System.Web/System.Web.Compilation/BaseCompiler.cs	12 Dec 2002 03:20:19 -0000	1.3
+++ class/System.Web/System.Web.Compilation/BaseCompiler.cs	21 Jan 2003 13:28:05 -0000
@@ -82,9 +82,9 @@
 				if (references == null)
 					return result.ToString ();
 
-				split = references.Split (' ');
+				split = references.Split ('|');
 				foreach (string s in split)
-					result.AppendFormat (" /r:{0}", s);
+					result.AppendFormat (" /r:\"{0}\"", s);
 
 				return result.ToString ();
 			}
Index: class/System.Web/System.Web.Compilation/CachingCompiler.cs
===================================================================
RCS file: /cvs/public/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs,v
retrieving revision 1.2
diff -u -r1.2 CachingCompiler.cs
--- class/System.Web/System.Web.Compilation/CachingCompiler.cs	12 Dec 2002 03:20:19 -0000	1.2
+++ class/System.Web/System.Web.Compilation/CachingCompiler.cs	21 Jan 2003 13:28:05 -0000
@@ -136,6 +136,8 @@
 
 			Process proc = new Process ();
 			proc.StartInfo.FileName = "mcs";
+			if (System.IO.Path.DirectorySeparatorChar == '\\')
+				proc.StartInfo.FileName = "mcs.bat";
 			proc.StartInfo.Arguments = options.ToString ();
 			proc.StartInfo.UseShellExecute = false;
 			proc.StartInfo.RedirectStandardOutput = true;
Index: mcs/driver.cs
===================================================================
RCS file: /cvs/public/mcs/mcs/driver.cs,v
retrieving revision 1.130
diff -u -r1.130 driver.cs
--- mcs/driver.cs	22 Dec 2002 06:44:47 -0000	1.130
+++ mcs/driver.cs	21 Jan 2003 13:28:05 -0000
@@ -383,7 +383,7 @@
 			foreach (Assembly a in assemblies){
 				string codebase = a.CodeBase;
 				if (codebase.EndsWith ("corlib.dll")){
-					return codebase.Substring (0, codebase.LastIndexOf ("/"));
+					return codebase.Substring (0, codebase.LastIndexOf (System.IO.Path.DirectorySeparatorChar));
 				}
 			}
 

--=-=-=--