Permalink
Browse files

Handle non-existing files.

darcs-hash:20051128044913-71b0c-815a22650755ef540c3e597ddd6d950a59293415.gz
  • Loading branch information...
1 parent 707fad7 commit 3f07256b22ea9a5d91966493a7ae18e413da05c6 @pupeno committed Nov 28, 2005
Showing with 9 additions and 7 deletions.
  1. +9 −7 chicken-il.scm
View
16 chicken-il.scm
@@ -14,7 +14,7 @@
(lambda (p)
(let loop ((c (read-char p)))
(cond ((eof-object? c)
- (error "unexpected end of file"))
+ (error 'get-includes "unexpected end of file"))
((and (char=? c #\<)
(char=? #\# (peek-char p)))
(read-char p)
@@ -37,9 +37,11 @@
;; Get the list of files passed as arguments to this program.
(define file (first (rest (argv))))
-;; Get a list of the extensions needed by those files.
-(define includes (get-includes file))
-
-;; Print the list of includes with no parenthesis and separated by spaces.
-(display (string-join includes " "))
-(newline)
+;; Check if the file exists. It is not an error because it is ok to include a file that doesn't exists and gets generated latter (is it ?). This is the case of chicken-syntax-case.
+(when (file-exists? file)
+ ;; Get a list of the extensions needed by those files.
+ (define includes (get-includes file))
+
+ ;; Print the list of includes with no parenthesis and separated by spaces.
+ (display (string-join includes " "))
+ (newline))

0 comments on commit 3f07256

Please sign in to comment.