2003-06-02 Nick Drochak <ndrochak@gol.com>
authorNick Drochak <nickd@mono-cvs.ximian.com>
Mon, 2 Jun 2003 14:18:03 +0000 (14:18 -0000)
committerNick Drochak <nickd@mono-cvs.ximian.com>
Mon, 2 Jun 2003 14:18:03 +0000 (14:18 -0000)
* FileInfo.cs (MoveTo): Throw exceptions when dest exists, and check
for null too.

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

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

index 30bf3b49c9c15a0cf576a31904aabc78822852f6..eccf71867a96e165a3534af33c5207b303c11731 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-02  Nick Drochak <ndrochak@gol.com>
+
+       * FileInfo.cs (MoveTo): Throw exceptions when dest exists, and check
+       for null too.
+
 2003-05-27  Lluis Sanchez Gual <lluis@ximian.com>
 
        * BinaryReader.cs: Stream don't need to be seekable to use PeekChar.
index 7a0984c7c29e1ab64c62dea225503ecdea2de44b..7e53a7d97263a2cdba130991e893f9074ec03223 100644 (file)
@@ -133,10 +133,16 @@ namespace System.IO {
                        }
                }
                
-               public void MoveTo (string dest) {\r
-                       File.Move (FullPath, dest);\r
-               }\r
-\r
+               public void MoveTo (string dest) {
+                       if (dest == null)
+                               throw new ArgumentNullException ();
+                       MonoIOError error;
+                       if (MonoIO.Exists (dest, out error) ||
+                               MonoIO.ExistsDirectory (dest, out error))
+                               throw new IOException ();
+                       File.Move (FullPath, dest);
+               }
+
                public FileInfo CopyTo (string path) {\r
                        return CopyTo (path, false);\r
                }\r