From 0e5fa766e4148682719d0bafd77f2d37a3539e96 Mon Sep 17 00:00:00 2001 From: Voczi Date: Tue, 25 Jun 2024 18:23:28 +0200 Subject: [PATCH] Fix usage of plugin in Windows --- .../src/main/java/com/slack/keeper/ZipFlingerExt.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/keeper-gradle-plugin/src/main/java/com/slack/keeper/ZipFlingerExt.kt b/keeper-gradle-plugin/src/main/java/com/slack/keeper/ZipFlingerExt.kt index 1b1c4a2a..672b4cef 100644 --- a/keeper-gradle-plugin/src/main/java/com/slack/keeper/ZipFlingerExt.kt +++ b/keeper-gradle-plugin/src/main/java/com/slack/keeper/ZipFlingerExt.kt @@ -30,7 +30,18 @@ internal fun File.classesSequence(): Sequence> { .filter { it.extension == "class" } .filterNot { "META-INF" in it.name } .sortedBy { it.invariantSeparatorsPath } - .map { it.absolutePath.removePrefix(prefix).removePrefix("/") to it } + .map { + // zip specification "4.4.17.1 file name: (Variable)" items: + it.absolutePath + // "The name of the file, with optional relative path. + // The path stored MUST NOT contain a drive or + // device letter, or a leading slash" + .removePrefix(prefix) + .removePrefix(File.separator) + // "All slashes MUST be forward slashes '/' as opposed + // to backwards slashes '\' for compatibility" + .replace(File.separator, "/") to it + } } /** Extracts classes from the target [jar] into this archive. */