From 22b721be8a6220c6e99f202e66f4429e43e0e08b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 16 Jan 2019 21:29:01 -0700 Subject: [PATCH] io: require absolute path for `current-load-relative-directory` --- racket/src/io/path/api.rkt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/racket/src/io/path/api.rkt b/racket/src/io/path/api.rkt index d125e427ad..36762dfcdd 100644 --- a/racket/src/io/path/api.rkt +++ b/racket/src/io/path/api.rkt @@ -9,6 +9,7 @@ ;; get `chaperone-procedure` that doesn't support keyword arguments: chaperone-procedure) "path.rkt" + "relativity.rkt" "simplify.rkt" "directory-path.rkt") @@ -63,4 +64,12 @@ (define/who current-load-relative-directory (let ([guard (make-guard-paths who #f)]) - (make-derived-parameter raw:current-load-relative-directory guard guard))) + (define full-guard + (case-lambda + [() (guard)] + [(v) (when v + (unless (and (path-string? v) + (complete-path? v)) + (raise-argument-error who "(or/c (and/c path-string? complete-path?) #f)" v))) + (guard v)])) + (make-derived-parameter raw:current-load-relative-directory full-guard full-guard)))