aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-04-01 23:25:58 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-04-01 23:25:58 -0700
commit5d3453b6645e7fbc99f5817894f6f032728654e1 (patch)
tree58f650708b13b22c5ed592c32088fb05c0782d05
parenta74cdefbf7b2b1b0062cb640a398751a5f3180d9 (diff)
downloadconsfigurator-5d3453b6645e7fbc99f5817894f6f032728654e1.tar.gz
FILE:CONTAINS-LINES: cope with non-existent file
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--src/property/file.lisp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/property/file.lisp b/src/property/file.lisp
index fb8d38c..66d8373 100644
--- a/src/property/file.lisp
+++ b/src/property/file.lisp
@@ -45,7 +45,8 @@ CONTENT can be a list of lines or a single string."
(:apply
(with-change-if-changes-file-content (path)
(let ((new-lines (copy-list (ensure-cons lines)))
- (existing-lines (lines (readfile path))))
+ (existing-lines (and (remote-exists-p path)
+ (lines (readfile path)))))
(dolist (existing-line existing-lines)
(deletef new-lines existing-line :test #'string=))
(writefile path (unlines (nconc existing-lines new-lines)))))))