aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÓscar Nájera <hi@oscarnajera.com>2021-05-29 17:02:03 +0200
committerÓscar Nájera <hi@oscarnajera.com>2021-05-29 17:04:29 +0200
commit7bc91be2375141a9d2a95503538bd776e5587663 (patch)
tree9f912a0423dba9d907c2703ad2321d73452f9d22
parente59d033dc3deca5c3169ab5f375d8d4748dc8029 (diff)
downloaddotfiles-7bc91be2375141a9d2a95503538bd776e5587663.tar.gz
dotfiles-7bc91be2375141a9d2a95503538bd776e5587663.tar.bz2
dotfiles-7bc91be2375141a9d2a95503538bd776e5587663.zip
Make directories before symlinking files
-rwxr-xr-xinstall.scm6
1 files changed, 6 insertions, 0 deletions
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)))))