2004-04-02 Dick Porter <dick@ximian.com>
[mono.git] / mcs / class / corlib / System.IO / FileInfo.cs
index 7a0984c7c29e1ab64c62dea225503ecdea2de44b..62e79d489ecaddc5de87f3afdfe67dfffc87037e 100644 (file)
@@ -18,16 +18,21 @@ namespace System.IO {
        public sealed class FileInfo : FileSystemInfo {\r
        \r
 
-                private bool exists = false;
+               private bool exists;
 
                public FileInfo (string path) {\r
                        CheckPath (path);\r
                \r
                        OriginalPath = path;\r
                        FullPath = Path.GetFullPath (path);
-                       exists = File.Exists (path);
+               }\r
+               \r
+               internal override void InternalRefresh ()\r
+               {\r
+                       exists = File.Exists (FullPath);\r
                }\r
 \r
+\r
                // public properties\r
 \r
                public override bool Exists {\r
@@ -133,10 +138,17 @@ 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);
+                       this.FullPath = Path.GetFullPath (dest);
+               }
+
                public FileInfo CopyTo (string path) {\r
                        return CopyTo (path, false);\r
                }\r