X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=rags.git;a=blobdiff_plain;f=rags.scm;h=b60a1215b8274f9ed6d9eef53272c91d2175dc74;hp=ecc861854ea1ec771a2b388f8c5b08a0bb1b4166;hb=e7fdd07ebdf69cc9565345e1f20b429b42fcc3f9;hpb=aadb0c8602819fe3dbaf7a283c4f7697f1971641 diff --git a/rags.scm b/rags.scm index ecc8618..b60a121 100644 --- a/rags.scm +++ b/rags.scm @@ -159,9 +159,12 @@ (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))