diff options
Diffstat (limited to 'src/property/file.lisp')
-rw-r--r-- | src/property/file.lisp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/property/file.lisp b/src/property/file.lisp index 9d23446..c49a703 100644 --- a/src/property/file.lisp +++ b/src/property/file.lisp @@ -35,19 +35,12 @@ CONTENT can be a list of lines or a single string." (declare (indent 1)) (:desc (declare (ignore content mode mode-supplied-p)) #?"${path} has defined content") - (:apply (let ((content (etypecase content - (cons (unlines content)) - (string (format nil "~A~&" content))))) - (if (and (remote-exists-p path) - (multiple-value-bind (existing-mode existing-size) - (remote-file-mode-and-size path) - (and (or (not mode-supplied-p) (= existing-mode mode)) - ;; Avoid downloading arbitrarily large files. - (>= (* 4 (length content)) existing-size) - (string= (readfile path) content)))) - :no-change - (apply #'writefile - path content (and mode-supplied-p `(:mode ,mode))))))) + (:apply (apply #'maybe-writefile-string + path + (etypecase content + (cons (unlines content)) + (string (format nil "~A~&" content))) + (and mode-supplied-p `(:mode ,mode))))) (defprop contains-lines :posix (path &rest lines) "Ensure there is a file at PATH containing each of LINES once." |