@@ -8,6 +8,7 @@ import java.io.{ File => JFile, OutputStreamWriter, BufferedWriter, ByteArrayInp
88import java .util .{ List => JList , Arrays }
99import java .nio .file .Path
1010import java .nio .charset .StandardCharsets
11+ import java .io .File .{ separator => sep }
1112
1213import com .vladsch .flexmark .parser .ParserEmulationProfile
1314import com .vladsch .flexmark .parser .Parser
@@ -164,8 +165,8 @@ case class Site(
164165 private def defaultParams (pageLocation : JFile , additionalDepth : Int = 0 ): DefaultParams = {
165166 val pathFromRoot = stripRoot(pageLocation)
166167 val baseUrl : String = {
167- val rootLen = root.getAbsolutePath.split('/' ).length
168- val assetLen = pageLocation.getAbsolutePath.split('/' ).length
168+ val rootLen = root.getAbsolutePath.split(sep ).length
169+ val assetLen = pageLocation.getAbsolutePath.split(sep ).length
169170 " ../" * (assetLen - rootLen - 1 + additionalDepth) + " ."
170171 }
171172
@@ -195,12 +196,12 @@ case class Site(
195196 // Suffix is index.html for packages and therefore the additional depth
196197 // is increased by 1
197198 val (suffix, offset) =
198- if (e.kind == " package" ) (" / index.html" , - 1 )
199+ if (e.kind == " package" ) (sep + " index.html" , - 1 )
199200 else (" .html" , 0 )
200201
201- val target = mkdirs(fs.getPath(outDir.getAbsolutePath + " / api/ " + e.path.mkString(" / " ) + suffix))
202+ val target = mkdirs(fs.getPath(outDir.getAbsolutePath + sep + " api" + sep + e.path.mkString(sep ) + suffix))
202203 val params = defaultParams(target.toFile, - 1 ).withPosts(blogInfo).withEntity(Some (e)).toMap
203- val page = new HtmlPage (" _layouts/ api-page.html" , layouts(" api-page" ).content, params, includes)
204+ val page = new HtmlPage (" _layouts" + sep + " api-page.html" , layouts(" api-page" ).content, params, includes)
204205
205206 render(page).foreach { rendered =>
206207 val source = new ByteArrayInputStream (rendered.getBytes(StandardCharsets .UTF_8 ))
@@ -217,9 +218,9 @@ case class Site(
217218 }
218219
219220 // generate search page:
220- val target = mkdirs(fs.getPath(outDir.getAbsolutePath + " / api/ search.html" ))
221+ val target = mkdirs(fs.getPath(outDir.getAbsolutePath + sep + " api" + sep + " search.html" ))
221222 val searchPageParams = defaultParams(target.toFile, - 1 ).withPosts(blogInfo).toMap
222- val searchPage = new HtmlPage (" _layouts/ search.html" , layouts(" search" ).content, searchPageParams, includes)
223+ val searchPage = new HtmlPage (" _layouts" + sep + " search.html" , layouts(" search" ).content, searchPageParams, includes)
223224 render(searchPage).foreach { rendered =>
224225 Files .copy(
225226 new ByteArrayInputStream (rendered.getBytes(StandardCharsets .UTF_8 )),
@@ -230,7 +231,7 @@ case class Site(
230231 }
231232
232233 /** Generate HTML files from markdown and .html sources */
233- def generateHtmlFiles (outDir : JFile = new JFile (root.getAbsolutePath + " / _site" ))(implicit ctx : Context ): this .type =
234+ def generateHtmlFiles (outDir : JFile = new JFile (root.getAbsolutePath + sep + " _site" ))(implicit ctx : Context ): this .type =
234235 createOutput(outDir) {
235236 compilableFiles.foreach { asset =>
236237 val pathFromRoot = stripRoot(asset)
@@ -250,7 +251,7 @@ case class Site(
250251 }
251252
252253 /** Generate blog from files in `blog/_posts` and output in `outDir` */
253- def generateBlog (outDir : JFile = new JFile (root.getAbsolutePath + " / _site" ))(implicit ctx : Context ): this .type =
254+ def generateBlog (outDir : JFile = new JFile (root.getAbsolutePath + sep + " _site" ))(implicit ctx : Context ): this .type =
254255 createOutput(outDir) {
255256 blogposts.foreach { file =>
256257 val BlogPost .extract(year, month, day, name, ext) = file.getName
0 commit comments