Improve loading of files
This commit is contained in:
parent
40566cee5b
commit
9c683792be
1 changed files with 5 additions and 12 deletions
|
@ -80,18 +80,11 @@
|
|||
(define (stored-file xdg-env file)
|
||||
"Try to get FILE stored either in XDG-ENV or the home directory."
|
||||
(let ((xdg (getenv xdg-env))
|
||||
(home (getenv "HOME"))
|
||||
(result #f))
|
||||
(cond
|
||||
(xdg
|
||||
(let ((xdg-stored-file (string-append xdg "/undone/" file)))
|
||||
(when (file-exists? xdg-stored-file)
|
||||
(set! result xdg-stored-file))))
|
||||
(home
|
||||
(let ((home-stored-file (string-append home "/.undone/" file)))
|
||||
(when (file-exists? home-stored-file)
|
||||
(set! result home-stored-file)))))
|
||||
result))
|
||||
(stored-file (string-append
|
||||
(getenv "HOME") "/.undone/" file)))
|
||||
(unless (or (file-exists? stored-file) (not xdg))
|
||||
(set! stored-file (string-append xdg "/undone/" file)))
|
||||
stored-file))
|
||||
|
||||
(define (config-file file)
|
||||
"Try to get FILE from the configuration file location."
|
||||
|
|
Loading…
Reference in a new issue