Load rc from appropriate location

This commit is contained in:
Tom Willemsen 2012-08-14 21:23:46 +02:00
parent a90567ae22
commit 7376a87f72

View file

@ -20,6 +20,16 @@
(define todo-list-file "todo.scm") (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 (define todo-list
(if (file-exists? todo-list-file) (if (file-exists? todo-list-file)
(let* ((port (open-input-file todo-list-file)) (let* ((port (open-input-file todo-list-file))
@ -86,7 +96,7 @@
(apply view-func '())))) (apply view-func '()))))
(define (main args) (define (main args)
(load "/home/slash/undonerc.scm") (load rc-file)
(if (> (length args) 1) (if (> (length args) 1)
(case (string->symbol (cadr args)) (case (string->symbol (cadr args))
((add) ((add)