2004-04-02 Dick Porter <dick@ximian.com>
[mono.git] / mcs / class / corlib / System.IO / DirectoryInfo.cs
index 21d0329b5a924705acc327dfee013685caba432a..b46376bb77becbd4325377a2358540cbe83c125b 100644 (file)
@@ -43,19 +43,30 @@ namespace System.IO {
 \r
                public override string Name {\r
                        get {\r
-                               return Path.GetFileName (FullPath);\r
+                               string result = Path.GetFileName (FullPath);\r
+                               if (result == null || result == "")
+                                       return FullPath;
+                               return result;
                        }\r
                }\r
 \r
                public DirectoryInfo Parent {\r
                        get {\r
-                               return new DirectoryInfo (Path.GetDirectoryName (FullPath));\r
+                               string dirname = Path.GetDirectoryName (FullPath);
+                               if (dirname == null)
+                                       return null;
+
+                               return new DirectoryInfo (dirname);
                        }\r
                }\r
 \r
                public DirectoryInfo Root {\r
                        get {\r
-                               return new DirectoryInfo (Path.GetPathRoot (FullPath));\r
+                               string root = Path.GetPathRoot (FullPath);
+                               if (root == null)
+                                       return null;
+
+                               return new DirectoryInfo (root);
                        }\r
                }\r
 \r
@@ -125,11 +136,11 @@ namespace System.IO {
                }\r
 \r
                public void MoveTo (string dest) {\r
-                       Directory.Move (FullPath, dest);\r
+                       Directory.Move (FullPath, Path.GetFullPath (dest));
                }\r
 \r
                public override string ToString () {\r
-                       return OriginalPath;\r
+                       return OriginalPath;
                }\r
        }\r
 }\r