diff --git a/undone/main.scm b/undone/main.scm index cac9581..322a73e 100644 --- a/undone/main.scm +++ b/undone/main.scm @@ -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."