diff options
Diffstat (limited to '')
-rw-r--r-- | module/calp/entry-points/html.scm | 4 | ||||
-rw-r--r-- | module/calp/main.scm | 23 |
2 files changed, 15 insertions, 12 deletions
diff --git a/module/calp/entry-points/html.scm b/module/calp/entry-points/html.scm index b2f613ea..8c400e1d 100644 --- a/module/calp/entry-points/html.scm +++ b/module/calp/entry-points/html.scm @@ -19,7 +19,7 @@ :use-module ((sxml simple) :select (sxml->xml)) :use-module ((sxml transformations) :select (href-transformer)) - :use-module (directories) + :use-module ((xdg basedir) :prefix xdg-) :autoload (vcomponent instance) (global-event-object) ) @@ -74,7 +74,7 @@ ;; TODO nicer way to resolve static (let ((link (path-append output-directory "/static"))) (unless (file-exists? link) - (symlink (path-append data-directory "www/static") link))))) + (symlink (path-append (xdg-data-home) "/calp/www/static") link))))) (define (re-root-static tree) diff --git a/module/calp/main.scm b/module/calp/main.scm index 2a7944a9..e336846a 100644 --- a/module/calp/main.scm +++ b/module/calp/main.scm @@ -8,7 +8,6 @@ :use-module ((util config) :select (set-config! get-config get-configuration-documentation)) :use-module (util options) :use-module ((util hooks) :select (shutdown-hook)) - :use-module (directories) :use-module ((text markup) :select (sxml->ansi-text)) @@ -19,6 +18,8 @@ :use-module (statprof) :use-module (calp repl) + :use-module ((xdg basedir) :prefix xdg-) + ) @@ -106,8 +107,9 @@ (when stprof (statprof-start)) - (cond [(eqv? #t repl) (repl-start (format #f "~a/calp-~a" - runtime-directory (getpid)))] + (cond [(eqv? #t repl) (repl-start (format #f "~a/calp-~a" + (xdg-runtime-dir) + (getpid)))] [repl => repl-start]) (if altconfig @@ -119,8 +121,8 @@ (awhen (find file-exists? (list - (path-append user-config-directory "/config.scm") - (path-append system-config-directory "/config.scm"))) + (path-append (xdg-config-home) "/calp/config.scm") + (path-append (xdg-sysconfdir) "/calp/config.scm"))) (primitive-load it))) @@ -160,21 +162,22 @@ (throw 'return)) (when (option-ref opts 'update-zoneinfo #f) - (let ((pipe - (let-env ((PREFIX (get-config 'path-prefix))) - (open-input-pipe (path-append libexec "/tzget"))))) + (let* ((locations (list "/usr/libexec/calp/tzget" (path-append (xdg-data-home) "/tzget"))) + (filename (or (find file-exists? locations) + (error "tzget not installed, please put it in one of ~a" locations))) + (pipe (open-input-pipe filename))) ;; (define path (read-line pipe)) (define line ((@ (ice-9 rdelim) read-line) pipe)) (define names (string-split line #\space)) ((@ (util io) with-atomic-output-to-file) - (path-append data-directory "/zoneinfo.scm") + (path-append (xdg-data-home) "/calp/zoneinfo.scm") (lambda () (write `(set-config! 'tz-list ',names)) (newline) (write `(set-config! 'last-zoneinfo-upgrade ,((@ (datetime) current-date)))) (newline))))) ;; always load zoneinfo if available. - (let ((z (path-append data-directory "/zoneinfo.scm"))) + (let ((z (path-append (xdg-data-home) "/calp/zoneinfo.scm"))) (when (file-exists? z) (primitive-load z))) |