summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-12-15 12:06:51 +0000
committerwisberg <wisberg>2003-12-15 12:06:51 +0000
commit38aa20202ee04c6fa31dcf827c310a65dc4b96ed (patch)
tree08e758f80307fff1feadb6e3ff4a95c66616125b /util
parent62dd8185b52695fe284ce88db2f58c85dc257987 (diff)
downloadaspectj-38aa20202ee04c6fa31dcf827c310a65dc4b96ed.tar.gz
aspectj-38aa20202ee04c6fa31dcf827c310a65dc4b96ed.zip
inpath support
Diffstat (limited to 'util')
-rw-r--r--util/src/org/aspectj/util/LangUtil.java24
1 files changed, 24 insertions, 0 deletions
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[][])