[Mono-list] System.IO.File patch

Mike Gray mike@mikegray.org
Fri, 03 May 2002 23:17:29 -0400


Fixes bug #24199, also adding in the missing CreateText method.

Mike Gray


Index: File.cs
===================================================================
RCS file: /mono/mcs/class/corlib/System.IO/File.cs,v
retrieving revision 1.9
diff -u -r1.9 File.cs
--- File.cs	3 Apr 2002 06:28:50 -0000	1.9
+++ File.cs	4 May 2002 03:13:18 -0000
@@ -36,7 +36,7 @@
		{
			if (src == null || dest == null)
				throw new ArgumentNullException ();
-			if (src == "" || dest == null ||
+			if (src == "" || dest == "" ||
			    src.IndexOfAny (Path.InvalidPathChars) != -1 ||
			    dest.IndexOfAny (Path.InvalidPathChars) != -1)
				throw new ArgumentException ();
@@ -56,6 +56,11 @@
					       FileShare.None, buffersize);
		}

+        public static StreamWriter CreateText(string path)
+        {
+            return new StreamWriter (path, false);
+        }
+
		public static void Delete (string path)
		{
			if (path == null)
@@ -105,7 +110,7 @@
		{
			if (src == null || dest == null)
				throw new ArgumentNullException ();
-			if (src == "" || dest == null ||
+			if (src == "" || dest == "" ||
			    src.IndexOfAny (Path.InvalidPathChars) != -1 ||
			    dest.IndexOfAny (Path.InvalidPathChars) != -1)
				throw new ArgumentException ();



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.