From 8f9b59690660f85aeae675989fe9fe6b1b830445 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Fri, 11 Mar 2022 09:22:58 -0600 Subject: separated app from lib systems; added with-client-state --- lib/util.lisp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/util.lisp') diff --git a/lib/util.lisp b/lib/util.lisp index 31e1984..2a6d456 100644 --- a/lib/util.lisp +++ b/lib/util.lisp @@ -1,4 +1,4 @@ -;;;; util.lisp +;;;; util.lisp -- bits and bobs ;; Copyright (C) 2022 Colin Okay @@ -51,3 +51,13 @@ the directories that appear in the value of that variable." (ensure-directories-exist pathname) (with-open-file (out pathname :direction :output :if-exists if-exists) (print printable-object out))) + +(defun read-from-file (path) + "Reads one form from the file at PATHNAME, if that file exists. Returns NIL if not." + (when (uiop:file-exists-p path) + (with-open-file (input path) + (read input)))) + +(defun true-or-false (what) + "Returns the strings \"true\" or \"false\" depending on whehter or not WHAT is null" + (if what "true" "false")) -- cgit v1.2.3