Skip to content

Commit d5fcfcf

Browse files
authored
Merge pull request #15023 from dotty-staging/scaladoc/external-windows-paths
Fix windows paths handling in legacy external link provider
2 parents dca4bb1 + 58a19ef commit d5fcfcf

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

scaladoc/src/dotty/tools/scaladoc/ExternalDocLink.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object ExternalDocLink:
3030
case path :: apiUrl :: Nil => for {
3131
url <- tryParse(mapping, "url")(URL(apiUrl))
3232
} yield ExternalDocLink(
33-
List(s"$path.*".r),
33+
List(s"${Regex.quote(path)}.*".r),
3434
url,
3535
DocumentationKind.Scaladoc2,
3636
None
@@ -65,4 +65,4 @@ object ExternalDocLink:
6565
packageList
6666
)
6767
case _ =>
68-
fail(mapping, "Accepted format: `regexStr::docToolStr::urlStr[::rest]`")
68+
fail(mapping, "Accepted format: `regexStr::docToolStr::urlStr[::rest]`")

scaladoc/test/dotty/tools/scaladoc/ExternalLocationProviderIntegrationTest.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,14 @@ class Scaladoc3ExternalLocationProviderIntegrationTest extends ExternalLocationP
5555
)
5656
)
5757

58+
def getScalaLibraryPath: String = {
59+
val classpath: List[String] = System.getProperty("java.class.path").split(java.io.File.pathSeparatorChar).toList
60+
classpath.find(_.contains("scala-library-2")).getOrElse("foobarbazz") // If we don't find the scala 2 library, the test will fail
61+
}
62+
5863
class Scaladoc2LegacyExternalLocationProviderIntegrationTest extends LegacyExternalLocationProviderIntegrationTest(
5964
"externalScaladoc2",
60-
List(".*scala.*#https://www.scala-lang.org/api/current/"),
65+
List(s"${getScalaLibraryPath}#https://www.scala-lang.org/api/current/"),
6166
List(
6267
"https://www.scala-lang.org/api/current/scala/util/matching/Regex$$Match.html",
6368
"https://www.scala-lang.org/api/current/scala/Predef$.html#String",

0 commit comments

Comments
 (0)