This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 293ad682e31 CAMEL-21442: camel-jbang export is not working when local-kamelet-dir set to current dir (#16906) 293ad682e31 is described below commit 293ad682e312ebd9fdac49c90d242595c43d3916 Author: Thomas Diesler <tdies...@redhat.com> AuthorDate: Fri Jan 24 07:31:06 2025 +0100 CAMEL-21442: camel-jbang export is not working when local-kamelet-dir set to current dir (#16906) --- .../camel/dsl/jbang/core/commands/ExportBaseCommand.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java index 9312f91cc1f..d081c11cddf 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java @@ -579,8 +579,9 @@ public abstract class ExportBaseCommand extends CamelCommand { boolean web = "html".equals(ext) || "js".equals(ext) || "css".equals(ext) || "jpeg".equals(ext) || "jpg".equals(ext) || "png".equals(ext) || "ico".equals(ext); File srcWeb = new File(srcResourcesDir, "META-INF/resources"); - File target = java ? srcJavaDir : camel ? srcCamelResourcesDir : kamelet ? srcKameletsResourcesDir + File targetDir = java ? srcJavaDir : camel ? srcCamelResourcesDir : kamelet ? srcKameletsResourcesDir : web ? srcWeb : srcResourcesDir; + targetDir.mkdirs(); File source; if ("kamelet".equals(k) && localKameletDir != null) { @@ -591,13 +592,12 @@ public abstract class ExportBaseCommand extends CamelCommand { } File out; if (source.isDirectory()) { - out = target; + out = targetDir; } else { - out = new File(target, source.getName()); + out = new File(targetDir, source.getName()); } if (!java) { if (kamelet) { - out.getParentFile().mkdirs(); safeCopy(source, out, true); } else if (jkube) { // file should be renamed and moved into src/main/jkube @@ -928,7 +928,7 @@ public abstract class ExportBaseCommand extends CamelCommand { } if (source.isDirectory()) { - // flattern files if they are from a directory + // flatten files if they are from a directory File[] children = source.listFiles(); if (children != null) { for (File child : children) {