From 618d362f09c89f7b2dcf1abc61b2c68b9dbd21e1 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 1 Mar 2018 07:54:12 -0700 Subject: [PATCH] load, ...: make sure load handlers receive paths --- racket/src/expander/eval/load.rkt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/racket/src/expander/eval/load.rkt b/racket/src/expander/eval/load.rkt index c2233ee259..1c8592385a 100644 --- a/racket/src/expander/eval/load.rkt +++ b/racket/src/expander/eval/load.rkt @@ -11,17 +11,19 @@ (define/who (load s) (check who path-string? s) + (define p (->path s)) (call-with-current-load-relative-directory - s + p (lambda () - ((current-load) s #f)))) + ((current-load) p #f)))) (define/who (load-extension s) (check who path-string? s) + (define p (->path s)) (call-with-current-load-relative-directory - s + p (lambda () - ((current-load-extension) s #f)))) + ((current-load-extension) p #f)))) (define (call-with-current-load-relative-directory p thunk) (define-values (base name dir?) (split-path p)) @@ -35,7 +37,8 @@ (define/who (load/use-compiled f) (check who path-string? f) - ((current-load/use-compiled) f #f)) + (define p (->path f)) + ((current-load/use-compiled) p #f)) ;; used for the -k command-line argument: (define (embedded-load start end str as-predefined?) @@ -60,3 +63,8 @@ (parameterize ([current-module-declare-as-predefined as-predefined?]) ((current-eval) e)) (loop)))))) + +;; ---------------------------------------- + +(define (->path s) + (if (string? s) (string->path s) s))