summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-10-10 05:25:59 +0100
committerjao <jao@gnu.org>2022-10-10 05:25:59 +0100
commit53b7279550a06967f660656363daa87bb261a753 (patch)
tree64018dfdb7a6edcbbe34a53f46b685aff8a8ba12
parent3996898343681ea082b64c3d5d393400e6af708f (diff)
downloadgeiser-chez-53b7279550a06967f660656363daa87bb261a753.tar.gz
geiser-chez-53b7279550a06967f660656363daa87bb261a753.tar.bz2
load-file: adjust current-directory to loaded file's
Not totally sure it's always what we want, but makes effective the ("." . ".") default entry in library-directories.
-rw-r--r--src/geiser/geiser.ss10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/geiser/geiser.ss b/src/geiser/geiser.ss
index c982006..654a346 100644
--- a/src/geiser/geiser.ss
+++ b/src/geiser/geiser.ss
@@ -55,13 +55,17 @@
(define (obj-file-name name) (with-extension name ".so"))
+ (define (file-directory filename)
+ (let ((idx (last-index-of (string->list filename) #\/ 0 -1)))
+ (if (= idx -1) filename (substring filename 0 idx))))
+
(define (geiser:load-file filename)
(let ((output-filename (obj-file-name filename)))
(call-with-result
(lambda ()
- (with-output-to-string
- (lambda () (maybe-compile-file filename output-filename)))
- (parameterize ([compile-imported-libraries #t])
+ (parameterize ([current-directory (file-directory filename)])
+ (with-output-to-string
+ (lambda () (maybe-compile-file filename output-filename)))
(load output-filename))))))
(define (geiser:add-to-load-path path)