commit b0fb013bac0ad806bc90e487b552d3affa7f7413 Solene Rapenne <solene@quafe.perso.pw> 2017-01-23 15:00:40 +0100 Abort if a file is non-existent
generator.lisp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/generator.lisp b/generator.lisp index ee0bb77..3ceaeb3 100644 --- a/generator.lisp +++ b/generator.lisp @@ -35,11 +35,15 @@ ;; load a file as a string ;; we escape ~ to avoid failures with format (defun load-file(path) - (replace-all - (strip-quotes - (with-open-file (stream path) - (loop for line = (read-line stream nil) while line collect line))) - "~" "~~")) + (if (probe-file path) + (replace-all + (strip-quotes + (with-open-file (stream path) + (loop for line = (read-line stream nil) while line collect line))) + "~" "~~") + (progn + (format t "ERROR : file ~a not found. Aborting~%" path) + (quit)))) ;; save a string in a file (defun save-file(path data)