Merge pull request #901 from Blewzman/FixAggregateExceptionGetBaseException
[mono.git] / mcs / class / corlib / System.IO / Path.cs
index a1a6d12130103b05335efc67dc00bdd3beeb8308..217f5af3992db30931b28c8ca4d709857bfc226c 100644 (file)
@@ -741,6 +741,9 @@ namespace System.IO {
                                                else
                                                        return current + ret;
                                        }
+                               } else {
+                                       if (root != "" && ret.Length > 0 && ret [0] != '/')
+                                               ret = root + ret;
                                }
                                return ret;
                        }
@@ -784,13 +787,21 @@ namespace System.IO {
                        var ret = new StringBuilder ();
                        int pathsLen = paths.Length;
                        int slen;
+                       need_sep = false;
+
                        foreach (var s in paths) {
-                               need_sep = false;
                                if (s == null)
                                        throw new ArgumentNullException ("One of the paths contains a null value", "paths");
+                               if (s.Length == 0)
+                                       continue;
                                if (s.IndexOfAny (InvalidPathChars) != -1)
                                        throw new ArgumentException ("Illegal characters in path.");
-                               
+
+                               if (need_sep) {
+                                       need_sep = false;
+                                       ret.Append (DirectorySeparatorStr);
+                               }
+
                                pathsLen--;
                                if (IsPathRooted (s))
                                        ret.Length = 0;
@@ -802,9 +813,6 @@ namespace System.IO {
                                        if (p1end != DirectorySeparatorChar && p1end != AltDirectorySeparatorChar && p1end != VolumeSeparatorChar)
                                                need_sep = true;
                                }
-                               
-                               if (need_sep)
-                                       ret.Append (DirectorySeparatorStr);
                        }
 
                        return ret.ToString ();