Unix paths fix
authorMarcos Henrich <marcos.henrich@xamarin.com>
Sat, 30 Jan 2016 11:55:17 +0000 (11:55 +0000)
committerMarek Safar <marek.safar@gmail.com>
Tue, 3 May 2016 09:42:40 +0000 (11:42 +0200)
DiscoveryClientProtocol.GetRelativePath was harcoded to use '\\'.

Fixes #36116

mcs/class/referencesource/System.Web.Services/System/Web/Services/Discovery/DiscoveryClientProtocol.cs

index de45dfdd88f94cb2fbdb63136def461dabcecf5a..aafe6f1c776a3ed34422bf6a8254c463e8e7dda3 100644 (file)
@@ -453,15 +453,15 @@ namespace System.Web.Services.Discovery {
             while (currentDir.Length > 0) {
                 if (currentDir.Length <= fullPath.Length && string.Compare(currentDir, fullPath.Substring(0, currentDir.Length), StringComparison.OrdinalIgnoreCase) == 0) {
                     answer += fullPath.Substring(currentDir.Length);
-                    if (answer.StartsWith("\\", StringComparison.Ordinal))
+                    if (answer.StartsWith(""+Path.DirectorySeparatorChar, StringComparison.Ordinal))
                         answer = answer.Substring(1);
                     return answer;
                 }
-                answer += "..\\";
+                answer += ".." + Path.DirectorySeparatorChar;
                 if (currentDir.Length < 2)
                     break;
                 else {
-                    int lastSlash = currentDir.LastIndexOf('\\', currentDir.Length - 2);
+                    int lastSlash = currentDir.LastIndexOf(Path.DirectorySeparatorChar, currentDir.Length - 2);
                     currentDir = currentDir.Substring(0, lastSlash + 1);
                 }
             }