From 2e06afc15a6e3aa3242d3f401077f27db9a6b771 Mon Sep 17 00:00:00 2001 From: "GitHubLeakedPAN, GitHubLeakedMyautsai" Date: Wed, 21 Jun 2023 14:22:02 +0800 Subject: [PATCH] Improve AbstractDistributeTask.getBundlePathByExtension --- .../groovy/org/openbakery/AbstractDistributeTask.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xcode-plugin/src/main/groovy/org/openbakery/AbstractDistributeTask.groovy b/xcode-plugin/src/main/groovy/org/openbakery/AbstractDistributeTask.groovy index 02ede265..f705c93d 100644 --- a/xcode-plugin/src/main/groovy/org/openbakery/AbstractDistributeTask.groovy +++ b/xcode-plugin/src/main/groovy/org/openbakery/AbstractDistributeTask.groovy @@ -97,7 +97,7 @@ class AbstractDistributeTask extends AbstractXcodeTask { throw new IllegalStateException("package does not exist: " + packageDirectory) } - Pattern pattern = Pattern.compile(".*" + extension) + Pattern pattern = Pattern.compile(".*\." + extension + "$") def fileList = packageDirectory.list( [accept: { d, f -> f ==~ pattern }] as FilenameFilter ).toList() @@ -107,6 +107,10 @@ class AbstractDistributeTask extends AbstractXcodeTask { throw new IllegalStateException("No bundle with extension '" + extension + "' found") } + if (fileList.size() > 1) { + throw new IllegalStateException("Multiple bundles with extension '" + extension + "' found") + } + return new File(packageDirectory, fileList.get(0)) }