From 38aa20202ee04c6fa31dcf827c310a65dc4b96ed Mon Sep 17 00:00:00 2001 From: wisberg Date: Mon, 15 Dec 2003 12:06:51 +0000 Subject: [PATCH] inpath support --- util/src/org/aspectj/util/LangUtil.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/util/src/org/aspectj/util/LangUtil.java b/util/src/org/aspectj/util/LangUtil.java index e51718706..28fb36021 100644 --- a/util/src/org/aspectj/util/LangUtil.java +++ b/util/src/org/aspectj/util/LangUtil.java @@ -318,6 +318,30 @@ public class LangUtil { return (String[]) result.toArray(new String[0]); } + /** + * Select from input String[] if readable directories + * @param inputs String[] of input - null ignored + * @param baseDir the base directory of the input + * @return String[] of input that end with any input + */ + public static String[] selectDirectories(String[] inputs, File baseDir) { + if (LangUtil.isEmpty(inputs)) { + return new String[0]; + } + ArrayList result = new ArrayList(); + for (int i = 0; i < inputs.length; i++) { + String input = inputs[i]; + if (null == input) { + continue; + } + File inputFile = new File(baseDir, input); + if (inputFile.canRead() && inputFile.isDirectory()) { + result.add(input); + } + } + return (String[]) result.toArray(new String[0]); + } + /** * copy non-null two-dimensional String[][] * @see extractOptions(String[], String[][]) -- 2.39.5