clarified file URLs, notably for Windows UNC paths;
authorwenzelm
Tue, 03 Jan 2017 19:22:17 +0100
changeset 64766 6fd05caf55f0
parent 64765 8ae1af3f88b1
child 64767 f5c4ffdb1124
clarified file URLs, notably for Windows UNC paths;
src/Pure/General/url.scala
src/Tools/VSCode/src/vscode_resources.scala
--- a/src/Pure/General/url.scala	Tue Jan 03 17:33:08 2017 +0100
+++ b/src/Pure/General/url.scala	Tue Jan 03 19:22:17 2017 +0100
@@ -81,8 +81,6 @@
     if (name.startsWith("file://")) name
     else {
       val s = name.replaceAll(" ", "%20")
-      if (!Platform.is_windows) "file://" + s
-      else if (s.startsWith("\\\\")) "file:" + s.replace('\\', '/')
-      else "file:///" + s.replace('\\', '/')
+      "file://" + (if (Platform.is_windows) s.replace('\\', '/') else s)
     }
 }
--- a/src/Tools/VSCode/src/vscode_resources.scala	Tue Jan 03 17:33:08 2017 +0100
+++ b/src/Tools/VSCode/src/vscode_resources.scala	Tue Jan 03 19:22:17 2017 +0100
@@ -50,8 +50,8 @@
   override def append(dir: String, source_path: Path): String =
   {
     val path = source_path.expand
-    if (path.is_absolute) "file://" + path.implode
-    else if (dir == "") "file://" + (File.pwd() + path).implode
+    if (path.is_absolute) Url.platform_file(path)
+    else if (dir == "") Url.platform_file(File.pwd() + path)
     else if (path.is_current) dir
     else Url.normalize_file(dir + "/" + path.implode)
   }