save-history should ensure the directory exists

This commit is contained in:
Alex Shinn 2015-05-08 07:28:47 +09:00
parent 5b6ca8e760
commit d222b152b6
2 changed files with 3 additions and 1 deletions

View file

@ -47,6 +47,7 @@
(define (save-history cfg) (define (save-history cfg)
(let ((history-file (conf-input-history-file cfg))) (let ((history-file (conf-input-history-file cfg)))
(guard (exn (else (warn "couldn't save history to " history-file))) (guard (exn (else (warn "couldn't save history to " history-file)))
(create-directory* (path-directory history-file))
(call-with-output-file history-file (call-with-output-file history-file
(lambda (out) (lambda (out)
(write (remove (lambda (x) (equal? x "")) (write (remove (lambda (x) (equal? x ""))

View file

@ -4,5 +4,6 @@
restore-history save-history) restore-history save-history)
(import (scheme base) (scheme char) (scheme read) (scheme write) (import (scheme base) (scheme char) (scheme read) (scheme write)
(scheme file) (scheme process-context) (srfi 1) (scheme file) (scheme process-context) (srfi 1)
(chibi config) (chibi show) (chibi stty) (chibi term edit-line)) (chibi config) (chibi filesystem) (chibi pathname)
(chibi show) (chibi stty) (chibi term edit-line))
(include "interface.scm")) (include "interface.scm"))