On Sun, Nov 10, 2019 at 7:38 PM Jon Zeppieri <zeppi...@gmail.com> wrote:
>
> On Sun, Nov 10, 2019 at 4:45 PM Jon Zeppieri <zeppi...@gmail.com> wrote:
> >
> > On Sun, Nov 10, 2019 at 3:26 PM Jon Zeppieri <zeppi...@gmail.com> wrote:
> > > =====
> > > ;; If the tzdata package is installed, put its zoneinfo directory at
> > > ;; the head of the search path.
> > > (define-runtime-path-list tzdata-paths
> > >   (match (find-relevant-directories '(tzdata-zoneinfo-module-path))
> > >     [(cons info-dir _)
> > >      (define path ((get-info/full info-dir) 'tzdata-zoneinfo-module-path))
> > >      (list path)]
> > >     [_
> > >      null]))

I found a version that works, though I still wonder if there'a a
better approach:

=====
;; If the tzdata package is installed, put its zoneinfo directory at
;; the head of the search path.
(define-syntax (detect-tzdata stx)
  (syntax-case stx ()
    [(_)
     (match (find-relevant-directories '(tzdata-zoneinfo-module-path))
       [(cons info-dir _)
        (let ([path ((get-info/full info-dir) 'tzdata-zoneinfo-module-path)])
          #`(begin
              (define-runtime-path tzdata-path '#,path)
              (current-zoneinfo-search-path
               (cons (simplify-path tzdata-path)
                     (current-zoneinfo-search-path)))))]
       [_ #'(void)])]))

(detect-tzdata)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAKfDxxy%2BMebOuymzgupND-1G668-mquS5uWjbQbmYuV%3D7bc__Q%40mail.gmail.com.

Reply via email to