Browse files

Fixed issue with file paths at load time.

  • Loading branch information...
1 parent 9c2c996 commit 266e2b22e01fdddd239bc41534b2fb5b9e9e5c35 Josh Marchán committed Aug 4, 2011
Showing with 6 additions and 5 deletions.
  1. +0 −2
  2. +6 −3 shortening.lisp
@@ -86,8 +86,6 @@ your machines.
* If you run this on localhost, you can have some fun with your hosts file. I added 'lch' as a local
hostname, so I can access shortening using <http://lch:8181/ShRTuRL>.
* There's an rc.shortening script that can be used with Arch Linux to daemonize the shortener.
-* If you run it as a daemon, but start it as a user with a ~/.shortening.conf file, that file will
- be used as the configuration, instead of /etc/shortening.conf.
# License
@@ -9,10 +9,13 @@
(defparameter *url-length* 6)
(defvar *external-db* nil)
-(defparameter *config-locations* (list (merge-pathnames ".shortening.conf" (user-homedir-pathname))
- #P"/etc/shortening.conf"))
+(defun config-location ()
+ (find-if #'probe-file
+ (list (merge-pathnames ".shortening.conf" (user-homedir-pathname))
+ #P"/etc/shortening.conf")))
(defun load-config ()
- (when-let* ((config-path (find-if #'probe-file *config-locations*))
+ (when-let* ((config-path (config-location))
(config (handler-case (read-files (make-config) (list config-path))
(configparser-error ()
(format *error-output*

0 comments on commit 266e2b2

Please sign in to comment.