Skip to content

Commit 1dd5752

Browse files
committed
Fixed concatenation
1 parent 7a6f885 commit 1dd5752

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

core/common/src/files/Paths.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public fun Path(base: String, vararg parts: String): Path {
7777
return Path(buildString {
7878
append(base)
7979
parts.forEach {
80-
if (!endsWith(Path.separator)) {
80+
if (isNotEmpty() && !endsWith(Path.separator)) {
8181
append(Path.separator)
8282
}
8383
append(it)

core/common/test/files/SmokeFileTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ class SmokeFileTest {
178178
constructAbsolutePath("a", "b", "..", "c"),
179179
Path("${Path.separator}a", "b", "..${Path.separator}c").toString()
180180
)
181+
182+
assertEquals(constructRelativePath("a", "b", "c"),
183+
Path("", "a", "b", "c").toString())
181184
}
182185

183186
@Test

0 commit comments

Comments
 (0)