commit 0f51443cc603fc89d582b24d1c13fd49b1c89ea7 Spenser Truex <truex@equwal.com> 2025-09-01 16:59:18 -0400 Move two more functions to generators-util
generator-aux.lisp | 15 --------------- generators-util.lisp | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/generator-aux.lisp b/generator-aux.lisp index 2ff43af..536e1ef 100644 --- a/generator-aux.lisp +++ b/generator-aux.lisp @@ -32,21 +32,6 @@ (if left-separator-position (+ 1 left-separator-position) 0) (- count 1)))))) -(defun load-file(path) - "Load a file as a string. We escape ~ to avoid failures with format." - (if (probe-file path) - (handler-case (with-open-file (stream path :if-exists :supersede :if-does-not-exist :create) - (let ((contents (make-string (file-length stream)))) - (read-sequence contents stream) - contents)) - (file-error (condition) - (cerror "ERROR : file ~a not found. Aborting~%" condition))) - )) - -(defun save-file(path data) - "Save a string to a file." - (with-open-file (stream path :direction :output :if-exists :supersede :if-does-not-exist :create) - (write-sequence data stream))) (defun date-format(format date) "Format a date using the given format string with template substitutions." diff --git a/generators-util.lisp b/generators-util.lisp index 3ea2ccf..c76559d 100644 --- a/generators-util.lisp +++ b/generators-util.lisp @@ -27,3 +27,19 @@ output))) +(defun load-file(path) + "Load a file as a string. We escape ~ to avoid failures with format." + (if (probe-file path) + (handler-case (with-open-file (stream path :if-exists :supersede :if-does-not-exist :create) + (let ((contents (make-string (file-length stream)))) + (read-sequence contents stream) + contents)) + (file-error (condition) + (cerror "ERROR : file ~a not found. Aborting~%" condition))) + )) + +(defun save-file(path data) + "Save a string to a file." + (with-open-file (stream path :direction :output :if-exists :supersede :if-does-not-exist :create) + (write-sequence data stream))) +