File[] currentGoldenDirs = null;
TreeSet<String> goldDirSet = new TreeSet<>(); if (goldenDir != null) {
currentGoldenDirs = goldenDir.listFiles(); for (int i=0; i<currentGoldenDirs.length; i++) {
goldDirSet.add(currentGoldenDirs[i].getName());
}
}
// now go through the list of members if (currentGoldenDirs != null) { for (int i=0; i<currentGoldenDirs.length; i++) {
File newGoldenDir = currentGoldenDirs[i];
// do not traverse SCCS directories... if (!(newGoldenDir.getAbsolutePath().endsWith("SCCS")) || traversSccsDirs ) { // start a compare of this child and the like-named test child...
File newTestDir = new File(testDir.getAbsolutePath() + FILE_SEPARATOR +
newGoldenDir.getName());
if (newTestDir.exists()) { if (newGoldenDir.isDirectory()) { if (newTestDir.isDirectory()) {
whatToDoWithMatchingDirs(newGoldenDir, newTestDir); Thread t = newThread( new DirDiff(newGoldenDir, newTestDir));
t.start();
} else {
whatToDoWithNonMatchingChildren(newGoldenDir, newTestDir);
}
} else { // of... newGoldenDir.isDirectory()... if (newTestDir.isDirectory()) {
whatToDoWithNonMatchingChildren(newGoldenDir, newTestDir);
}
whatToDoWithMatchingFiles(newGoldenDir, newTestDir);
}
} else { // of... newTestDir.exists()... if (newGoldenDir.isDirectory()) {
whatToDoWithMissingDirs(newTestDir); Thread t = newThread( new DirDiff(newGoldenDir, newTestDir));
t.start();
} else {
whatToDoWithMissingFiles(newTestDir);
}
}
}
}
}
// look for extra test objs... if (currentTestDirs != null) { for (int i=0; i<currentTestDirs.length; i++) { // do not traverse SCCS directories... if (!(currentTestDirs[i].getAbsolutePath().endsWith("SCCS")) || traversSccsDirs ) { if (!goldDirSet.contains(currentTestDirs[i].getName())) { if (currentTestDirs[i].isDirectory()) {
whatToDoWithExtraDirs(currentTestDirs[i]); if (recurseExtraDirs) { Thread t = newThread( new DirDiff( null, currentTestDirs[i]));
t.start();
}
} else {
whatToDoWithExtraFiles(currentTestDirs[i]);
}
}
}
}
}
}
publicstaticvoid main(String[] args) { if (args.length != 2) {
System.err.println("You must provide two directory names on the command line.");
System.err.println("Usage:\tDirDiff dir1 dir2");
System.err.println("\tJava Runtime Properties (set to \"true\"):");
System.err.println("\t\tsccs\trecurse SCCS directories");
System.err.println("\t\tverbose\tprint verbose diagnostics");
System.err.println("\t\trecurse\trecursing extra directories showing extra files");
System.err.println("\t\tsizeTolerance\tset tolerance for size differences - default is infinite");
System.exit(0);
} else {
File golden = new File(args[0]);
File test = new File(args[1]);
if (!golden.exists()) {
System.err.println("Error: path " + golden.getAbsolutePath() + " does not exist. Skipping.");
System.exit(0);
} if (!golden.isDirectory()) {
System.err.println("Error: path " + golden.getAbsolutePath() + " must be a directory. Skipping.");
System.exit(0);
} if (!test.exists()) {
System.err.println("Error: path " + test.getAbsolutePath() + " does not exist. Skipping.");
System.exit(0);
} if (!test.isDirectory()) {
System.err.println("Error: path " + test.getAbsolutePath() + " must be a directory. Skipping.");
System.exit(0);
}
Thread t = newThread( new DirDiff(golden, test));
t.start();
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.