Commits

Moritz Heidkamp  committed 3326768

Some arbitrary API changes

  • Participants
  • Parent commits 630efd8

Comments (0)

Files changed (1)

File xdg-basedir-impl.scm

   (or (current-application)
       (error "Parameter current-application is not set")))
 
-(define (home)
-  (get-environment-variable "HOME"))
+(define ((home path))
+  (make-pathname (get-environment-variable "HOME") path))
 
 (define (blank? x)
   (or (not x) (zero? (string-length x))))
 
-(define ((base-dir-from-env-var-or-home-path env-var home-path))
+(define ((dir-from-env/default env-var get-default))
   (let ((dir (get-environment-variable env-var)))
     (cond ((blank? dir)
-           (make-pathname (home) home-path))
+           (get-default))
           ((not (absolute-pathname? dir))
            (error (string-append env-var " must not be a relative path") dir))
           (else dir))))
 
-(define ((dirs-from-env-var/default env-var default))
+(define ((dirs-from-env/default env-var default))
   (let ((dirs (get-environment-variable env-var)))
     (if (blank? dirs)
         default
 ;;; XDG_DATA_HOME, XDG_DATA_DIRS
 
 (define data-home
-  (base-dir-from-env-var-or-home-path "XDG_DATA_HOME" ".local/share"))
+  (dir-from-env/default "XDG_DATA_HOME" (home ".local/share")))
 
 (define data-directories
-  (dirs-from-env-var/default "XDG_DATA_DIRS" '("/usr/local/share/" "/usr/share/")))
+  (dirs-from-env/default "XDG_DATA_DIRS" '("/usr/local/share/" "/usr/share/")))
 
 (define find-data-file
   (find-file data-home data-directories))
 ;;; XDG_CONFIG_HOME, XDG_CONFIG_DIRS
 
 (define config-home
-  (base-dir-from-env-var-or-home-path "XDG_CONFIG_HOME" ".config"))
+  (dir-from-env/default "XDG_CONFIG_HOME" (home ".config")))
 
 (define config-directories
-  (dirs-from-env-var/default "XDG_CONFIG_DIRS" '("/etc/xdg")))
+  (dirs-from-env/default "XDG_CONFIG_DIRS" '("/etc/xdg")))
 
 (define find-config-file
   (find-file config-home config-directories))
 ;;; XDG_CACHE_HOME
 
 (define cache-home
-  (base-dir-from-env-var-or-home-path "XDG_CACHE_HOME" ".cache"))
+  (dir-from-env/default "XDG_CACHE_HOME" (home ".cache")))
 
 (define cache-directory
   (home-dir config-home))