From 7376a87f72a17aaa2a07a6a211645b68b2b3a6ca Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 14 Aug 2012 21:23:46 +0200 Subject: [PATCH] Load rc from appropriate location --- undone/main.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/undone/main.scm b/undone/main.scm index dca8257..5bc0fb6 100644 --- a/undone/main.scm +++ b/undone/main.scm @@ -20,6 +20,16 @@ (define todo-list-file "todo.scm") +(define rc-file + (let* ((xdg (getenv "XDG_CONFIG_HOME")) + (home (getenv "HOME")) + (rc-file-name "undonerc.scm") + (xdg-rc-file (string-append xdg "/" rc-file-name)) + (home-rc-file (string-append home "/" rc-file-name))) + (if (and xdg (file-exists? xdg-rc-file)) + xdg-rc-file + home-rc-file))) + (define todo-list (if (file-exists? todo-list-file) (let* ((port (open-input-file todo-list-file)) @@ -86,7 +96,7 @@ (apply view-func '())))) (define (main args) - (load "/home/slash/undonerc.scm") + (load rc-file) (if (> (length args) 1) (case (string->symbol (cadr args)) ((add)