mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
warn when config fails to load
This commit is contained in:
parent
5f80618544
commit
c3189ebc9d
2 changed files with 18 additions and 3 deletions
|
@ -111,7 +111,11 @@
|
|||
(else (lp (cdr ls) (cons (car ls) rev))))))
|
||||
|
||||
(define (read-from-file file . opt)
|
||||
(guard (exn (else (and (pair? opt) (car opt))))
|
||||
(guard (exn
|
||||
(else
|
||||
(warn "couldn't load config:" file)
|
||||
(print-stack-trace exn)
|
||||
(and (pair? opt) (car opt))))
|
||||
(call-with-input-file file read)))
|
||||
|
||||
(define (alist? x)
|
||||
|
|
|
@ -10,6 +10,17 @@
|
|||
;; This is only used for config verification, it's acceptable to
|
||||
;; substitute file existence for the stronger directory check.
|
||||
(cond-expand
|
||||
(chibi (import (only (chibi filesystem) file-directory?)))
|
||||
(else (begin (define file-directory? file-exists?))))
|
||||
(chibi
|
||||
(import (only (meta) warn))
|
||||
(import (only (chibi) print-stack-trace))
|
||||
(import (only (chibi filesystem) file-directory?)))
|
||||
(else
|
||||
(begin
|
||||
(define file-directory? file-exists?)
|
||||
(define (print-stack-trace . o) #f)
|
||||
(define (warn msg . args)
|
||||
(let ((err (current-error-port)))
|
||||
(display msg err)
|
||||
(for-each (lambda (x) (display " " err) (write x err)) args)
|
||||
(newline err))))))
|
||||
(include "config.scm"))
|
||||
|
|
Loading…
Add table
Reference in a new issue