2002-05-09 Nick Drochak <ndrochak@gol.com>
authorNick Drochak <nickd@mono-cvs.ximian.com>
Wed, 8 May 2002 11:45:42 +0000 (11:45 -0000)
committerNick Drochak <nickd@mono-cvs.ximian.com>
Wed, 8 May 2002 11:45:42 +0000 (11:45 -0000)
* File.cs (Delete): Do not throw an exception if the file does not
exist.

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

mcs/class/corlib/System.IO/ChangeLog
mcs/class/corlib/System.IO/File.cs

index 3c841241af5c0642ffba426daec7cf4bee1ada03..c83af094b420ae4a8b70b2dcda9d6e8fa208ce2a 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-09  Nick Drochak  <ndrochak@gol.com>
+
+       * File.cs (Delete): Do not throw an exception if the file does not
+       exist.
+
 2002-05-08  Mike Gray     <mikeg@mikegray.org>
 
        * File.cs: According to ECMA spec and MS docs Copy(src, dest)
index e2608e10821649e5f0dee08798f9c8f28acbb16a..d68841592af26a1238df41bef3f4b546360a25e6 100644 (file)
@@ -57,19 +57,25 @@ namespace System.IO
                }\r
 
                public static StreamWriter CreateText(string path)
-               {
+               \r
+               {\r
                        return new StreamWriter (path, false);
+               \r
                }
                
+               \r
+               \r
                public static void Delete (string path)\r
                {\r
                        if (path == null)\r
                                throw new ArgumentNullException ();\r
                        if (path == "" || path.IndexOfAny (Path.InvalidPathChars) != -1)\r
                                throw new ArgumentException ();\r
-                       \r
-                       if (!MonoIO.DeleteFile (path))\r
-                               throw MonoIO.GetException ();\r
+                       if (!MonoIO.DeleteFile (path)){\r
+                               Exception e = MonoIO.GetException ();\r
+                               if (e != null && !(e is FileNotFoundException))\r
+                                       throw e;\r
+                       }\r
                }\r
                \r
                public static bool Exists (string path)\r