From 17c153810c8caeefa4759c7353f7871162cf96f5 Mon Sep 17 00:00:00 2001 From: Yahor Urbanovich Date: Sun, 24 Nov 2024 21:38:10 +0300 Subject: [PATCH] CLI tool not handled nested pack folder correctly --- .../valkyrie/cli/command/SvgXmlToImageVectorCommand.kt | 5 ++++- .../composegears/valkyrie/cli/SvgXmlToImageVectorCliTest.kt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/SvgXmlToImageVectorCommand.kt b/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/SvgXmlToImageVectorCommand.kt index 0174ea87..2afffe2f 100644 --- a/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/SvgXmlToImageVectorCommand.kt +++ b/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/SvgXmlToImageVectorCommand.kt @@ -205,7 +205,10 @@ private fun svgXml2ImageVector( ) vectorSpecOutput.content.writeToKt( - outputDir = outputPath.absolutePathString(), + outputDir = when { + useFlatPackage -> outputPath.absolutePathString() + else -> "${outputPath.absolutePathString()}/${nestedPackName.lowercase()}" + }, nameWithoutExtension = vectorSpecOutput.name, ) } diff --git a/cli/src/test/kotlin/io/github/composegears/valkyrie/cli/SvgXmlToImageVectorCliTest.kt b/cli/src/test/kotlin/io/github/composegears/valkyrie/cli/SvgXmlToImageVectorCliTest.kt index cc49a788..d9394809 100644 --- a/cli/src/test/kotlin/io/github/composegears/valkyrie/cli/SvgXmlToImageVectorCliTest.kt +++ b/cli/src/test/kotlin/io/github/composegears/valkyrie/cli/SvgXmlToImageVectorCliTest.kt @@ -203,7 +203,7 @@ class SvgXmlToImageVectorCliTest { arg.testConversion( inputResource = "imagevector/xml/ic_without_path.xml", expectedKtName = "WithoutPath.pack.nested.preview.kt", - actualKtName = "WithoutPath.kt", + actualKtName = "filled/WithoutPath.kt", iconPackName = IconPackName("ValkyrieIcons"), nestedPackName = NestedPackName("Filled"), generatePreview = GeneratePreview(true),