:names-checker can have a filename list

svn: r2513
This commit is contained in:
Eli Barzilay 2006-03-27 03:58:19 +00:00
parent dd942a3885
commit d328e461be
2 changed files with 10 additions and 4 deletions

View File

@ -953,10 +953,11 @@ submissions, do the following:
suffix that should be used for the single concatenated output file. suffix that should be used for the single concatenated output file.
* You can also add a `:names-checker' keyword -- the value can be a * You can also add a `:names-checker' keyword -- the value can be a
regexp that all submitted files must follow (eg, ".*[.]scm$"). regexp that all submitted files must follow (eg, ".*[.]scm$"), or a
Alternatively, it can be a 1-argument procedure that will receive list of expected file names. Alternatively, it can be a 1-argument
the (sorted) list of submitted files and can throw an error if some procedure that will receive the (sorted) list of submitted files and
files are missing or some files are forbidden. 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 * In the "info.ss" file of the handin-client you need to set
`enable-multifile-handin' to #t, and adjust `selection-default' to `enable-multifile-handin' to #t, and adjust `selection-default' to

View File

@ -299,6 +299,11 @@
(and (not (regexp-match names-checker n)) n)) (and (not (regexp-match names-checker n)) n))
names) names)
=> (lambda (file) (error* "bad filename: ~e" file))])] => (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 (error* "bad names-checker specification: ~e"
names-checker)]) names-checker)])
;; problem: students might think that submitting files one-by-one will keep ;; problem: students might think that submitting files one-by-one will keep