From 7bc91be2375141a9d2a95503538bd776e5587663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20N=C3=A1jera?= Date: Sat, 29 May 2021 17:02:03 +0200 Subject: Make directories before symlinking files --- install.scm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'install.scm') diff --git a/install.scm b/install.scm index c4190e0..2fa3ad1 100755 --- a/install.scm +++ b/install.scm @@ -92,11 +92,17 @@ (define (replace str pattern new) (regexp-substitute/global #f pattern str 'pre new 'post)) +(define (make-dir-parents dir-path) + (unless (access? dir-path F_OK) + (make-dir-parents (dirname dir-path)) + (mkdir dir-path))) + (define (config-links src target dry-run) (let ((src-path (expand-file src)) (target-path (replace (expand-file target) "dot-" "."))) (unless (and (symlink? target-path) (equal? (readlink target-path) src-path)) (rm-tree target-path dry-run) + (make-dir-parents (dirname target-path)) (symlink src-path target-path) (log-msg 'OK (string-append " Symlink " src " -> " target))))) -- cgit v1.2.3