diff options
-rw-r--r-- | henrietta-cache.scm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/henrietta-cache.scm b/henrietta-cache.scm index 023e16a..ae5c449 100644 --- a/henrietta-cache.scm +++ b/henrietta-cache.scm @@ -13,7 +13,7 @@ (chicken format) (chicken string) (chicken port) (chicken process) (chicken process-context) (chicken pathname) (chicken io) (chicken sort) - (chicken irregex) + (chicken irregex) (chicken file posix) http-client matchable uri-common srfi-1))) (define (usage code) @@ -125,7 +125,13 @@ EOF (begin (copy-file tmp-file cache-file) (delete-file tmp-file) )))) - (directory tmp-dir #t) ) + ;; Here we have to handle symlinks first. If we handle the + ;; _target_ before the symlink, target will be deleted and + ;; `copy-file' will break when trying to copy the symlink, as it + ;; will be dangling. + (sort (directory tmp-dir #t) + (lambda (f _) + (symbolic-link? (make-pathname tmp-dir f))))) (delete-directory tmp-dir #t) ) ;nb: don't like recursive but top level has hidden contents and don't want those (define (download-files-from-list base-uri files cache-dir) |