Skip to content
Snippets Groups Projects
Commit 3fce85fe authored by Jürgen Walter's avatar Jürgen Walter
Browse files

improved parsing of input directory

parent 3954e7e0
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment