summaryrefslogtreecommitdiff
path: root/gnu/home/services/symlink-manager.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/home/services/symlink-manager.scm')
-rw-r--r--gnu/home/services/symlink-manager.scm25
1 files changed, 18 insertions, 7 deletions
diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm
index b7a66c5518..24d21bfad3 100644
--- a/gnu/home/services/symlink-manager.scm
+++ b/gnu/home/services/symlink-manager.scm
@@ -54,6 +54,10 @@
(or (getenv "XDG_CONFIG_HOME")
(string-append (getenv "HOME") "/.config")))
+ (define xdg-data-home
+ (or (getenv "XDG_DATA_HOME")
+ (string-append (getenv "HOME") "/.local/share")))
+
(define backup-directory
(string-append home-directory "/" (number->string (current-time))
"-guix-home-legacy-configs-backup"))
@@ -61,13 +65,20 @@
(define (preprocess-file file)
"If file is in XDG-CONFIGURATION-FILES-DIRECTORY use
subdirectory from XDG_CONFIG_HOME to generate a target path."
- (if (string-prefix? #$xdg-configuration-files-directory file)
- (string-append
- (substring xdg-config-home
- (1+ (string-length home-directory)))
- (substring file
- (string-length #$xdg-configuration-files-directory)))
- file))
+ (cond
+ ((string-prefix? #$xdg-configuration-files-directory file)
+ (string-append
+ (substring xdg-config-home
+ (1+ (string-length home-directory)))
+ (substring file
+ (string-length #$xdg-configuration-files-directory))))
+ ((string-prefix? #$xdg-data-files-directory file)
+ (string-append
+ (substring xdg-data-home
+ (1+ (string-length home-directory)))
+ (substring file
+ (string-length #$xdg-data-files-directory))))
+ (else file)))
(define (target-file file)
;; Return the target of FILE, a config file name sans leading dot