Look for paths relative to source files

This commit is contained in:
Cadence Ember 2022-08-24 13:23:46 +12:00
parent 8c65b2ed02
commit 73a5cb68c5
Signed by: cadence
GPG Key ID: BC1C2C61CF521B17
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,6 @@
#lang racket/base
(require racket/path
racket/runtime-path
net/url
web-server/servlet-dispatch
web-server/dispatchers/filesystem-map
@ -15,6 +16,8 @@
"src/page-wiki.rkt"
"src/page-search.rkt")
(define-runtime-path path-static "static")
(define mime-types
(hash #".css" #"text/css"
#".svg" #"image/svg+xml"))
@ -30,7 +33,7 @@
(filter:make #rx"^/static/" (files:make
#:url->path
(lambda (u)
((make-url->path "static")
((make-url->path path-static)
(struct-copy url u [path (cdr (url-path u))])))
#:path->mime-type
(lambda (u)

View File

@ -1,8 +1,11 @@
#lang racket/base
(require racket/runtime-path)
(provide
config-get)
(define-runtime-path path-config "../config.txt")
(define (config-get key)
(hash-ref config key))
@ -18,7 +21,7 @@
default-config
(with-handlers ([exn:fail:filesystem:errno? (λ (exn)
'())])
(call-with-input-file "../config.txt"
(call-with-input-file path-config
(λ (in)
(let loop ([alist '()])
(let ([key (read in)]