Browse Source

2003-10-17 Pedro Mart�nez Juli� <[email protected]>

    * WebClient.cs: use Path.DirectorySeparator instead of "/" for
    windows compatibility. Add some checks for file paths like
    "C:/xxx/yyy/..." and like "/home/xxx/...".

svn path=/trunk/mcs/; revision=19127
Pedro Martínez Juliá 22 năm trước cách đây
mục cha
commit
4b9bf9ec29

+ 6 - 0
mcs/class/System/System.Net/ChangeLog

@@ -1,3 +1,9 @@
+2003-10-17  Pedro Martínez Juliá  <[email protected]>
+
+	* WebClient.cs: use Path.DirectorySeparator instead of "/" for
+	windows compatibility. Add some checks for file paths like
+	"C:/xxx/yyy/..." and like "/home/xxx/...".
+
 2003-10-16  Pedro Martínez Juliá  <[email protected]>
 
 	* WebClient.cs: added a slash between directory and file names.

+ 2 - 2
mcs/class/System/System.Net/WebClient.cs

@@ -296,11 +296,11 @@ namespace System.Net
 					return new Uri (path);
 				}
 				catch (System.UriFormatException ufe) {
-					if (path[0] == '/') {
+					if ((path[0] == Path.DirectorySeparatorChar) || (path[1] == ':' && Char.ToLower(path[0]) > 'a' && Char.ToLower(path[0]) < 'z')) {
 						return new Uri ("file://" + path);
 					}
 					else {
-						return new Uri ("file://" + Environment.CurrentDirectory + "/" + path);
+						return new Uri ("file://" + Environment.CurrentDirectory + Path.DirectorySeparatorChar + path);
 					}
 				}
 			}