mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Made recursive behavior optional, and caused hidden directories to always be skipped.
git-svn-id: https://zxing.googlecode.com/svn/trunk@1757 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
b21e0a935d
commit
a48dbeab11
|
@ -67,6 +67,7 @@ public final class CommandLineRunner {
|
||||||
public boolean dumpBlackPoint = false;
|
public boolean dumpBlackPoint = false;
|
||||||
public boolean multi = false;
|
public boolean multi = false;
|
||||||
public boolean brief = false;
|
public boolean brief = false;
|
||||||
|
public boolean recursive = false;
|
||||||
public int[] crop = null;
|
public int[] crop = null;
|
||||||
public int threads = 1;
|
public int threads = 1;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +174,8 @@ public final class CommandLineRunner {
|
||||||
config.multi = true;
|
config.multi = true;
|
||||||
} else if ("--brief".equals(arg)) {
|
} else if ("--brief".equals(arg)) {
|
||||||
config.brief = true;
|
config.brief = true;
|
||||||
|
} else if ("--recursive".equals(arg)) {
|
||||||
|
config.recursive = true;
|
||||||
} else if (arg.startsWith("--crop")) {
|
} else if (arg.startsWith("--crop")) {
|
||||||
config.crop = new int[4];
|
config.crop = new int[4];
|
||||||
String[] tokens = arg.substring(7).split(",");
|
String[] tokens = arg.substring(7).split(",");
|
||||||
|
@ -224,18 +227,20 @@ public final class CommandLineRunner {
|
||||||
if (inputFile.exists()) {
|
if (inputFile.exists()) {
|
||||||
if (inputFile.isDirectory()) {
|
if (inputFile.isDirectory()) {
|
||||||
for (File singleFile : inputFile.listFiles()) {
|
for (File singleFile : inputFile.listFiles()) {
|
||||||
if (singleFile.isDirectory()) {
|
|
||||||
// Recurse on nested directories.
|
|
||||||
addArgumentToInputs(singleFile.getAbsolutePath());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String filename = singleFile.getName().toLowerCase();
|
String filename = singleFile.getName().toLowerCase();
|
||||||
// Skip hidden files and text files (the latter is found in the blackbox tests).
|
// Skip hidden files and directories (e.g. svn stuff).
|
||||||
if (filename.startsWith(".") || filename.endsWith(".txt")) {
|
if (filename.startsWith(".")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Skip the results of dumping the black point.
|
// Recurse on nested directories if requested, otherwise skip them.
|
||||||
if (filename.contains(".mono.png")) {
|
if (singleFile.isDirectory()) {
|
||||||
|
if (config.recursive) {
|
||||||
|
addArgumentToInputs(singleFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Skip text files and the results of dumping the black point.
|
||||||
|
if (filename.endsWith(".txt") || filename.contains(".mono.png")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
inputs.addInput(singleFile.getAbsolutePath());
|
inputs.addInput(singleFile.getAbsolutePath());
|
||||||
|
@ -288,6 +293,7 @@ public final class CommandLineRunner {
|
||||||
System.err.println(" --dump_black_point: Compare black point algorithms as input.mono.png");
|
System.err.println(" --dump_black_point: Compare black point algorithms as input.mono.png");
|
||||||
System.err.println(" --multi: Scans image for multiple barcodes");
|
System.err.println(" --multi: Scans image for multiple barcodes");
|
||||||
System.err.println(" --brief: Only output one line per file, omitting the contents");
|
System.err.println(" --brief: Only output one line per file, omitting the contents");
|
||||||
|
System.err.println(" --recursive: Descend into subdirectories");
|
||||||
System.err.println(" --crop=left,top,width,height: Only examine cropped region of input image(s)");
|
System.err.println(" --crop=left,top,width,height: Only examine cropped region of input image(s)");
|
||||||
System.err.println(" --threads=n: The number of threads to use while decoding");
|
System.err.println(" --threads=n: The number of threads to use while decoding");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue