From 9e7ae974ade204ee822377b36fcec8e65540790e Mon Sep 17 00:00:00 2001 From: Goofyz Leung Date: Tue, 4 Jun 2024 10:24:42 +0800 Subject: [PATCH] fix: use `/` as path separator for all OS --- .../convention/src/main/kotlin/DataChecksumsPlugin.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/DataChecksumsPlugin.kt b/build-logic/convention/src/main/kotlin/DataChecksumsPlugin.kt index 7922d2fb43..9ffaade828 100644 --- a/build-logic/convention/src/main/kotlin/DataChecksumsPlugin.kt +++ b/build-logic/convention/src/main/kotlin/DataChecksumsPlugin.kt @@ -99,7 +99,7 @@ class DataChecksumsPlugin : Plugin { ?: mutableMapOf() fun File.allParents(): List = - if (parentFile == null || parentFile.path in map) { + if (parentFile == null || parentFile.invariantSeparatorsPath in map) { listOf() } else { listOf(parentFile) + parentFile.allParents() @@ -110,7 +110,7 @@ class DataChecksumsPlugin : Plugin { } logger.log(LogLevel.DEBUG, "${change.changeType}: ${change.normalizedPath}") val relativeFile = change.file.relativeTo(file.parentFile) - val key = relativeFile.path + val key = relativeFile.invariantSeparatorsPath if (change.changeType == ChangeType.REMOVED) { map.remove(key) } else { @@ -120,7 +120,7 @@ class DataChecksumsPlugin : Plugin { // calculate dirs inputDir.asFileTree.forEach { it.relativeTo(file.parentFile).allParents().forEach { p -> - map[p.path] = "" + map[p.invariantSeparatorsPath] = "" } } serialize(map.toSortedMap())