From d328e461be16f45b84d5d08b6cce9053903e95cf Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Mon, 27 Mar 2006 03:58:19 +0000 Subject: [PATCH] :names-checker can have a filename list svn: r2513 --- collects/handin-server/doc.txt | 9 +++++---- collects/handin-server/extra-utils.ss | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/collects/handin-server/doc.txt b/collects/handin-server/doc.txt index 6b18c311bc..11712bfe3d 100644 --- a/collects/handin-server/doc.txt +++ b/collects/handin-server/doc.txt @@ -953,10 +953,11 @@ submissions, do the following: suffix that should be used for the single concatenated output file. * You can also add a `:names-checker' keyword -- the value can be a - regexp that all submitted files must follow (eg, ".*[.]scm$"). - Alternatively, it can be a 1-argument procedure that will receive - the (sorted) list of submitted files and can throw an error if some - files are missing or some files are forbidden. + regexp that all submitted files must follow (eg, ".*[.]scm$"), or a + list of expected file names. Alternatively, it can be a 1-argument + procedure that will receive the (sorted) list of submitted files and + can throw an error if some files are missing or some files are + forbidden. * In the "info.ss" file of the handin-client you need to set `enable-multifile-handin' to #t, and adjust `selection-default' to diff --git a/collects/handin-server/extra-utils.ss b/collects/handin-server/extra-utils.ss index 7bd71c540c..930bcbe787 100644 --- a/collects/handin-server/extra-utils.ss +++ b/collects/handin-server/extra-utils.ss @@ -299,6 +299,11 @@ (and (not (regexp-match names-checker n)) n)) names) => (lambda (file) (error* "bad filename: ~e" file))])] + [(and (list? names-checker) (andmap string? names-checker)) + (let ([missing (remove* names names-checker)]) + (when (pair? missing) (error* "missing files: ~e" missing))) + (let ([extra (remove* names-checker names)]) + (when (pair? extra) (error* "unexpected files: ~e" extra)))] [names-checker (error* "bad names-checker specification: ~e" names-checker)]) ;; problem: students might think that submitting files one-by-one will keep