diff --git a/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java b/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java index d09f2678ec0088a30312f1bea3480e67e929aac0..9775268128fec97fe26b256a75150af31c36ac5b 100644 --- a/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java +++ b/tools.descartes.pmx.console/src/tools/descartes/pmx/console/PMXCommandLine.java @@ -28,6 +28,7 @@ package tools.descartes.pmx.console; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import org.apache.commons.cli.BasicParser; @@ -240,7 +241,7 @@ public class PMXCommandLine { String inputDirCmd = commandLine.getOptionValue(CMD_LONG_OPT_INPUT_DIR); String[] inputDirs = inputDirCmd.split(";"); for (int idx = 0; idx < inputDirs.length; idx++) { - final String inputDir = inputDirs[idx]; + final String inputDir = inputDirs[idx]; // + File.separator; if (inputDir == null) { log.info("missing value for command line option '" + CMD_LONG_OPT_INPUT_DIR + "'"); System.exit(1); @@ -249,11 +250,43 @@ public class PMXCommandLine { log.info("\tcurrent:" + System.getProperty("user.dir")); log.info("\trequested:" + inputDir); System.exit(1); // or other exit code? + } else { + // inputDirs[idx] = inputDir; + if (!new File(inputDir).getName().startsWith("kieker-")) { + String[] recursive = recursiveKiekerFileSearch(inputDir); + inputDirs = concat(inputDirs, recursive); + for (String sys : recursive) { + log.info(sys); + } + } + // inputDirs[idx] = null; } } return inputDirs; } + private String[] concat(String[] a, String[] b) { + int aLen = a.length; + int bLen = b.length; + String[] c = new String[aLen + bLen]; + System.arraycopy(a, 0, c, 0, aLen); + System.arraycopy(b, 0, c, aLen, bLen); + return c; + } + + String[] recursiveKiekerFileSearch(String inputDir) { + final String[] inputDirs; + // search subdirectories for folders "kieker- ..." + File[] fileArray = new File(inputDir).listFiles(); + ArrayList<String> inputDirList = new ArrayList<String>(); + for (int i = 0; i < fileArray.length; i++) { + if (fileArray[i].toString().contains("kieker-")) { + inputDirList.add(fileArray[i].getAbsolutePath() + File.separator); + } + } + return inputDirs = (String[]) inputDirList.toArray(new String[inputDirList.size()]); + } + private static FSReader registerFSReader(IAnalysisController analysisInstance, final String[] kiekerTraceFile) { final String[] inputDirs = kiekerTraceFile;