diff options
author | Nick Drochak <nickd@mono-cvs.ximian.com> | 2002-05-08 15:45:42 +0400 |
---|---|---|
committer | Nick Drochak <nickd@mono-cvs.ximian.com> | 2002-05-08 15:45:42 +0400 |
commit | 10a3af7b9e5cdc905fdba326d13e3ba97ea52810 (patch) | |
tree | f0da5c6454515299ca7b38cda7942f5bc6e407b9 /mcs/class/corlib/System.IO/File.cs | |
parent | 1a18b14e7c9c1a97d2fb8baac9298e8b55bdd7f9 (diff) |
2002-05-09 Nick Drochak <ndrochak@gol.com>
* File.cs (Delete): Do not throw an exception if the file does not
exist.
svn path=/trunk/mcs/; revision=4413
Diffstat (limited to 'mcs/class/corlib/System.IO/File.cs')
-rw-r--r-- | mcs/class/corlib/System.IO/File.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/mcs/class/corlib/System.IO/File.cs b/mcs/class/corlib/System.IO/File.cs index e2608e10821..d68841592af 100644 --- a/mcs/class/corlib/System.IO/File.cs +++ b/mcs/class/corlib/System.IO/File.cs @@ -57,19 +57,25 @@ namespace System.IO }
public static StreamWriter CreateText(string path) - { +
+ {
return new StreamWriter (path, false); +
} +
+
public static void Delete (string path)
{
if (path == null)
throw new ArgumentNullException ();
if (path == "" || path.IndexOfAny (Path.InvalidPathChars) != -1)
throw new ArgumentException ();
-
- if (!MonoIO.DeleteFile (path))
- throw MonoIO.GetException ();
+ if (!MonoIO.DeleteFile (path)){
+ Exception e = MonoIO.GetException ();
+ if (e != null && !(e is FileNotFoundException))
+ throw e;
+ }
}
public static bool Exists (string path)
|