Skip to content

Commit 1c721d8

Browse files
committed
Fix window path
1 parent 24a2798 commit 1c721d8

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

bench/src/main/scala/Benchmarks.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ object Bench {
3030
val iterations = if (intArgs.length > 1) intArgs(1).toInt else 20
3131
val forks = if (intArgs.length > 2) intArgs(2).toInt else 1
3232

33+
34+
import File.{ separator => sep }
35+
3336
val args2 = args1.map { arg =>
34-
if ((arg.endsWith(".scala") || arg.endsWith(".java")) && arg.head != '/') "../" + arg
37+
if ((arg.endsWith(".scala") || arg.endsWith(".java")) && !(new File(arg)).isAbsolute) ".." + sep + arg
3538
else arg
3639
}
3740
storeCompileOptions(args2)
@@ -61,9 +64,10 @@ object Bench {
6164
val libs = if (args.contains("-with-compiler")) compiler_libs else standard_libs
6265
var argsNorm = args.filter(_ != "-with-compiler")
6366

67+
import File.{ pathSeparator => sep }
6468
var cpIndex = argsNorm.indexOf("-classpath")
6569
if (cpIndex == -1) cpIndex = argsNorm.indexOf("-cp")
66-
if (cpIndex != -1) argsNorm(cpIndex + 1) = argsNorm(cpIndex + 1) + java.io.File.pathSeparator + libs
70+
if (cpIndex != -1) argsNorm(cpIndex + 1) = argsNorm(cpIndex + 1) + sep + libs
6771
else argsNorm = argsNorm :+ "-classpath" :+ libs
6872

6973
val file = new File(COMPILE_OPTS_FILE)

compiler/src/dotty/tools/dotc/consumetasty/ConsumeTasty.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ object ConsumeTasty {
1717
}
1818

1919
val currentClasspath = QuoteDriver.currentClasspath
20-
val args = "-from-tasty" +: "-classpath" +: s"$classpath:$currentClasspath" +: classes
20+
import java.io.File.{ pathSeparator => sep }
21+
val args = "-from-tasty" +: "-classpath" +: s"$classpath$sep$currentClasspath" +: classes
2122
(new Consume).process(args.toArray)
2223
}
2324
}

doc-tool/src/dotty/tools/dottydoc/staticsite/Site.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import java.io.{ File => JFile, OutputStreamWriter, BufferedWriter, ByteArrayInp
88
import java.util.{ List => JList, Arrays }
99
import java.nio.file.Path
1010
import java.nio.charset.StandardCharsets
11+
import java.io.File.{ separator => sep }
1112

1213
import com.vladsch.flexmark.parser.ParserEmulationProfile
1314
import com.vladsch.flexmark.parser.Parser
@@ -166,8 +167,8 @@ case class Site(
166167
private def defaultParams(pageLocation: JFile, additionalDepth: Int = 0): DefaultParams = {
167168
val pathFromRoot = stripRoot(pageLocation)
168169
val baseUrl: String = {
169-
val rootLen = root.getAbsolutePath.split('/').length
170-
val assetLen = pageLocation.getAbsolutePath.split('/').length
170+
val rootLen = root.getAbsolutePath.split(sep).length
171+
val assetLen = pageLocation.getAbsolutePath.split(sep).length
171172
"../" * (assetLen - rootLen - 1 + additionalDepth) + "."
172173
}
173174

@@ -197,16 +198,16 @@ case class Site(
197198
// Suffix is index.html for packages and therefore the additional depth
198199
// is increased by 1
199200
val (suffix, offset) =
200-
if (e.kind == "package") ("/index.html", -1)
201+
if (e.kind == "package") (sep + "index.html", -1)
201202
else (".html", 0)
202203

203204
val path = if (scala.util.Properties.isWin)
204205
e.path.map(_.replace("<", "_").replace(">", "_"))
205206
else
206207
e.path
207-
val target = mkdirs(fs.getPath(outDir.getAbsolutePath + "/api/" + path.mkString("/") + suffix))
208+
val target = mkdirs(fs.getPath(outDir.getAbsolutePath + sep + "api" + sep + path.mkString(sep) + suffix))
208209
val params = defaultParams(target.toFile, -1).withPosts(blogInfo).withEntity(Some(e)).toMap
209-
val page = new HtmlPage("_layouts/api-page.html", layouts("api-page").content, params, includes)
210+
val page = new HtmlPage("_layouts" + sep + "api-page.html", layouts("api-page").content, params, includes)
210211

211212
render(page).foreach { rendered =>
212213
val source = new ByteArrayInputStream(rendered.getBytes(StandardCharsets.UTF_8))
@@ -223,9 +224,9 @@ case class Site(
223224
}
224225

225226
// generate search page:
226-
val target = mkdirs(fs.getPath(outDir.getAbsolutePath + "/api/search.html"))
227+
val target = mkdirs(fs.getPath(outDir.getAbsolutePath + sep + "api" + sep + "search.html"))
227228
val searchPageParams = defaultParams(target.toFile, -1).withPosts(blogInfo).toMap
228-
val searchPage = new HtmlPage("_layouts/search.html", layouts("search").content, searchPageParams, includes)
229+
val searchPage = new HtmlPage("_layouts" + sep + "search.html", layouts("search").content, searchPageParams, includes)
229230
render(searchPage).foreach { rendered =>
230231
Files.copy(
231232
new ByteArrayInputStream(rendered.getBytes(StandardCharsets.UTF_8)),

project/Build.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -623,13 +623,13 @@ object Build {
623623
val args: List[String] = spaceDelimited("<arg>").parsed.toList
624624
val attList = (dependencyClasspath in Runtime).value
625625
val jars = packageAll.value
626+
import File.{ pathSeparator => sep }
626627

627628
val scalaLib = findLib(attList, "scala-library")
628629
val dottyLib = jars("dotty-library")
629630

630631
def run(args: List[String]): Unit = {
631-
val sep = File.pathSeparator
632-
val fullArgs = insertClasspathInArgs(args, s".$sep$dottyLib$sep$scalaLib")
632+
val fullArgs = insertClasspathInArgs(args, List(".", dottyLib, scalaLib).mkString(sep))
633633
runProcess("java" :: fullArgs, wait = true)
634634
}
635635

@@ -645,7 +645,7 @@ object Build {
645645
val asm = findLib(attList, "scala-asm")
646646
val dottyCompiler = jars("dotty-compiler")
647647
val dottyInterfaces = jars("dotty-interfaces")
648-
run(insertClasspathInArgs(args1, s"$dottyCompiler:$dottyInterfaces:$asm"))
648+
run(insertClasspathInArgs(args1, List(dottyCompiler, dottyInterfaces, asm).mkString(sep)))
649649
} else run(args)
650650
},
651651

@@ -1092,8 +1092,8 @@ object Build {
10921092
Developer(
10931093
id = "liufengyun",
10941094
name = "Liu Fengyun",
1095-
email = "[email protected]",
1096-
url = url("http://chaos-lab.com")
1095+
email = "[email protected]",
1096+
url = url("https://fengy.me")
10971097
),
10981098
Developer(
10991099
id = "nicolasstucki",

0 commit comments

Comments
 (0)