The Lambda Lab
/
projects
/
rags.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
aadb0c8
)
Scripts now evaluated with cwd set to their location.
author
Tim Vaughan
<plugd@thelambdalab.xyz>
Fri, 29 May 2020 08:34:54 +0000
(10:34 +0200)
committer
Tim Vaughan
<plugd@thelambdalab.xyz>
Fri, 29 May 2020 08:34:54 +0000
(10:34 +0200)
rags.scm
patch
|
blob
|
history
diff --git
a/rags.scm
b/rags.scm
index
ecc8618
..
b60a121
100644
(file)
--- a/
rags.scm
+++ b/
rags.scm
@@
-159,9
+159,12
@@
(define (serve-script config uri)
;; Scripts are responsible for the entire response, including header
(define (serve-script config uri)
;; Scripts are responsible for the entire response, including header
- (let ((path (document-path config uri)))
- (apply (eval (with-input-from-file path read))
- (list uri))))
+ (let* ((path (document-path config uri))
+ (proc (eval (with-input-from-file path read))))
+ (with-current-working-directory
+ (pathname-directory (document-path config uri))
+ (lambda ()
+ (apply proc (list uri))))))
(define (with-current-working-directory directory thunk)
(let ((old-wd (current-directory))
(define (with-current-working-directory directory thunk)
(let ((old-wd (current-directory))