Browse Source

root_dir is now optional

ov7a 9 years ago
parent
commit
d65af79190

+ 3 - 3
README.md

@@ -6,7 +6,7 @@ The options as of 2017/09/17 are:
 
 
 ```
 ```
 JPlag (Version 2.11.9-SNAPSHOT), Copyright (c) 2004-2017 KIT - IPD Tichy, Guido Malpohl, and others.
 JPlag (Version 2.11.9-SNAPSHOT), Copyright (c) 2004-2017 KIT - IPD Tichy, Guido Malpohl, and others.
-Usage: JPlag [ options ] <root-dir>
+Usage: JPlag [ options ] [<root-dir>] [-c file1 file2 ...]
  <root-dir>        The root-directory that contains all submissions
  <root-dir>        The root-directory that contains all submissions
 
 
 options are:
 options are:
@@ -59,8 +59,8 @@ The exclusion list contains a  number of suffixes.
 JPlag will ignore all files that end with one of the suffixes.
 JPlag will ignore all files that end with one of the suffixes.
 
 
 ### `-c [files]`   (Compare) Compare a list of files
 ### `-c [files]`   (Compare) Compare a list of files
-Example: `java -jar jplag-yourVersion.jar root_dir -l java17 -c student1_file student2_file student3_file`
-This option should be the last one.
+Example: `java -jar jplag-yourVersion.jar -l java17 -c student1_file student2_file student3_file`
+This option must be the last one.
 JPlag will compare just a list of files pairwise.
 JPlag will compare just a list of files pairwise.
 
 
 # Building JPlag
 # Building JPlag

+ 6 - 3
jplag/src/main/java/jplag/Program.java

@@ -444,9 +444,12 @@ public class Program implements ProgramI {
 
 
 	private void createSubmissionsFileList() throws jplag.ExitException {
 	private void createSubmissionsFileList() throws jplag.ExitException {
 		submissions = new Vector<Submission>();
 		submissions = new Vector<Submission>();
-		File f = new File(options.root_dir);
-		if (f == null || !f.isDirectory()) {
-			throw new jplag.ExitException(options.root_dir + " is not a directory!");
+		File f = null;
+		if (options.root_dir != null) {
+			f = new File(options.root_dir);
+			if (!f.isDirectory()) {
+				throw new jplag.ExitException(options.root_dir + " is not a directory!");
+			}
 		}
 		}
 		for (String file : options.fileList){
 		for (String file : options.fileList){
 			submissions.addElement(new Submission(file, f, this, get_language()));
 			submissions.addElement(new Submission(file, f, this, get_language()));

+ 1 - 1
jplag/src/main/java/jplag/options/Options.java

@@ -61,7 +61,7 @@ public abstract class Options {
 
 
 	public String sub_dir = null;
 	public String sub_dir = null;
 
 
-	public String root_dir = "";
+	public String root_dir = null;
 
 
 	public String original_dir = null;
 	public String original_dir = null;