aboutsummaryrefslogtreecommitdiff
path: root/lib/util.lisp
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-03-11 09:22:58 -0600
committerColin Okay <okay@toyful.space>2022-03-11 09:22:58 -0600
commit8f9b59690660f85aeae675989fe9fe6b1b830445 (patch)
treef05b323c50385de88a4762a9c1ee370ae6cf100f /lib/util.lisp
parente73fed7afb45d37a248f7b95d4a51bb4807a14a2 (diff)
separated app from lib systems; added with-client-state
Diffstat (limited to 'lib/util.lisp')
-rw-r--r--lib/util.lisp12
1 files changed, 11 insertions, 1 deletions
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"))