aboutsummaryrefslogtreecommitdiffstats
path: root/paths.scm
blob: 50bd6221da061a32e5ae7ea06c9db7c1efdb3b5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
;;; paths.scm -- Functions which work with/on paths
(declare (unit paths))

(define (stored-file xdg-env file)
  (let ((xdg (get-environment-variable xdg-env))
        (stored-file (string-append (get-environment-variable "HOME") "/.linkwave/" file)))
    (unless (or (file-exists? stored-file) (not xdg))
      (set! stored-file (string-append xdg "/linkwave/" file)))
    stored-file))

(: config-file (string -> string))
(define (config-file file)
  (stored-file "XDG_CONFIG_HOME" file))

(: data-file (string -> string))
(define (data-file file)
  (stored-file "XDG_DATA_HOME" file))