From 9c683792bef06e73fa34e8d1bea4a64f176fcf0e Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Wed, 26 Sep 2012 19:52:02 +0200 Subject: [PATCH] Improve loading of files --- undone/main.scm | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) 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."