Skip to content

Commit

Permalink
Fix windows report relative path (#419)
Browse files Browse the repository at this point in the history
* DO NOT MERGE check runs-on windows

* Fix windows report image path
  • Loading branch information
takahirom committed Jul 2, 2024
1 parent d2bf3af commit 741ff96
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import kotlinx.io.buffered
import kotlinx.io.bytestring.encodeToByteString
import kotlinx.io.files.Path
import kotlinx.io.files.SystemFileSystem
import kotlinx.io.files.SystemPathSeparator
import kotlinx.io.readString
import kotlinx.io.write

Expand Down Expand Up @@ -32,15 +33,15 @@ fun Path.relativeTo(base: Path): Path {
val path = buildString {
repeat(baseSegments.size - i) {
append("..")
append("/")
append(SystemPathSeparator)
}
append(thisSegments.subList(i, thisSegments.size).joinToString("/") { it })
append(thisSegments.subList(i, thisSegments.size).joinToString(SystemPathSeparator.toString()) { it })
}

return Path(path)
}

private fun String.segments(): List<String> = split("/")
private fun String.segments(): List<String> = split(SystemPathSeparator)

@OptIn(ExperimentalStdlibApi::class)
object KotlinxIo {
Expand Down

0 comments on commit 741ff96

Please sign in to comment.