From dc38a2522b8f568a4b5520622dbae0595ee8ef54 Mon Sep 17 00:00:00 2001 From: Kamil Bartoszek Date: Fri, 12 Apr 2024 09:19:19 +0200 Subject: [PATCH] Refactor file path manipulation to be OS-independent Modify the code to use File.separator for replacing the last part of the path, ensuring compatibility across different operating systems like Windows and Unix. --- src/main/kotlin/de/nanogiants/gradle/ext/TaskExt.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/de/nanogiants/gradle/ext/TaskExt.kt b/src/main/kotlin/de/nanogiants/gradle/ext/TaskExt.kt index 258d1f6..c15ae26 100644 --- a/src/main/kotlin/de/nanogiants/gradle/ext/TaskExt.kt +++ b/src/main/kotlin/de/nanogiants/gradle/ext/TaskExt.kt @@ -42,7 +42,7 @@ internal fun Task.addRenameMappingAction(oldOutput: File, newOutput: String, kee println(newOutput) doLast { - val newFile = File(oldOutput.absolutePath.replaceAfterLast("/", newOutput)) + val newFile = File(oldOutput.absolutePath.replaceAfterLast(File.separator, newOutput)) if (oldOutput.exists()) { oldOutput.copyTo(newFile, overwrite = true)