aboutsummaryrefslogtreecommitdiff
path: root/src/util.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-07-02 14:37:54 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-07-10 19:39:58 -0700
commit9533d3dde13d3ca06301514398551b90d291586e (patch)
treef86795f9af23fd7fcb6439d38fa28ff71254f5a5 /src/util.lisp
parentbf8e029d65eefd266c8c056662a83186cabb4a03 (diff)
downloadconsfigurator-9533d3dde13d3ca06301514398551b90d291586e.tar.gz
add INSTALLER:CLEANLY-INSTALLED-ONCE & some utils
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/util.lisp')
-rw-r--r--src/util.lisp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/util.lisp b/src/util.lisp
index 7fc2997..24ec85e 100644
--- a/src/util.lisp
+++ b/src/util.lisp
@@ -169,6 +169,14 @@ one solution is to convert your property to a :LISP property."
(enough-pathname pathname (pathname-directory-pathname pathname))
pathname))))
+(defun directory-contents (pathname)
+ "Return the immediate contents of PATHNAME, a directory, without resolving
+symlinks. Not suitable for use by :POSIX properties."
+ ;; On SBCL on Debian UIOP:*WILD-FILE-FOR-DIRECTORY* is #P"*.*".
+ (uiop:directory*
+ (merge-pathnames uiop:*wild-file-for-directory*
+ (ensure-directory-pathname pathname))))
+
(defun ensure-trailing-slash (namestring)
(if (string-suffix-p namestring "/")
namestring
@@ -297,6 +305,18 @@ expansion as a starting point for your own DEFPACKAGE form for your consfig."
else do (princ #\: s)
(loop-finish)))))))))
+(defun system (&rest args)
+ "Simple wrapper around system(3)."
+ (foreign-funcall
+ "system" :string (if (cdr args)
+ (escape-sh-command
+ (loop for arg in args
+ if (pathnamep arg)
+ collect (unix-namestring arg)
+ else collect arg))
+ (car args))
+ :int))
+
;;;; Progress & debug printing